Skip to content

Commit 37d2ec5

Browse files
committed
iOS contentRegion, coveringRegion 속성 추가 (#64)
1 parent 4f707c9 commit 37d2ec5

File tree

6 files changed

+30
-8
lines changed

6 files changed

+30
-8
lines changed

example/ios/Podfile.lock

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ PODS:
1919
- DoubleConversion
2020
- glog
2121
- glog (0.3.5)
22-
- NMapsMap (3.7.0)
22+
- NMapsMap (3.12.0)
2323
- RCTRequired (0.61.2)
2424
- RCTTypeSafety (0.61.2):
2525
- FBLazyVector (= 0.61.2)
@@ -340,7 +340,7 @@ SPEC CHECKSUMS:
340340
FBReactNativeSpec: 5a764c60abdc3336a213e5310c40b74741f32839
341341
Folly: 30e7936e1c45c08d884aa59369ed951a8e68cf51
342342
glog: 1f3da668190260b06b429bb211bfbee5cd790c28
343-
NMapsMap: 46ce3d48d7976dd10c6ec63cd7eecf655a7dd955
343+
NMapsMap: b04a3439eac78e52f48cb5a9e4ab994be1bcfc80
344344
RCTRequired: c639d59ed389cfb1f1203f65c2ea946d8ec586e2
345345
RCTTypeSafety: dc23fb655d6c77667c78e327bf661bc11e3b8aec
346346
React: 7e586e5d7bec12b91c1a096826b0fc9ab1da7865
@@ -367,6 +367,6 @@ SPEC CHECKSUMS:
367367
RNScreens: ac02d0e4529f08ced69f5580d416f968a6ec3a1d
368368
Yoga: 14927e37bd25376d216b150ab2a561773d57911f
369369

370-
PODFILE CHECKSUM: 5c246bd9cde0a72db54c6911641411b22b7dfb66
370+
PODFILE CHECKSUM: d122d63ce74ed04a61696282ef27e29391275003
371371

372372
COCOAPODS: 1.9.1

example/ios/example.xcodeproj/xcshareddata/xcschemes/example.xcscheme

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
</Testables>
7979
</TestAction>
8080
<LaunchAction
81-
buildConfiguration = "Release"
81+
buildConfiguration = "Debug"
8282
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
8383
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
8484
enableAddressSanitizer = "YES"

example/ios/example/Info.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<key>LSRequiresIPhoneOS</key>
2626
<true/>
2727
<key>NMFClientId</key>
28-
<string>ke9x5voiq8</string>
28+
<string>7xyduy51sa</string>
2929
<key>NSAppTransportSecurity</key>
3030
<dict>
3131
<key>NSAllowsArbitraryLoads</key>

index.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ export interface NaverMapViewProps {
9393
latitude: number;
9494
longitude: number;
9595
zoom: number;
96+
contentsRegion: [Coord, Coord, Coord, Coord, Coord];
97+
coveringRegion: [Coord, Coord, Coord, Coord, Coord];
9698
}) => void;
9799
onMapClick?: (event: {
98100
x: number;

ios/reactNativeNMap/RNNaverMapMarkerManager.m

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#import "RNNaverMapMarker.h"
1010
#import <React/RCTUIManager.h>
1111
#import <NMapsMap/NMGLatLng.h>
12+
#import <NMapsMap/NMFCameraCommon.h>
1213

1314
#import "RCTConvert+NMFMapView.h"
1415

ios/reactNativeNMap/RNNaverMapView.m

+22-3
Original file line numberDiff line numberDiff line change
@@ -92,19 +92,36 @@ - (void)removeReactSubview:(id<RCTComponent>)subview {
9292
}
9393
[_reactSubviews removeObject:(UIView *)subview];
9494
}
95+
9596
- (NSArray<id<RCTComponent>> *)reactSubviews {
9697
return _reactSubviews;
9798
}
9899

99100
- (void)mapViewIdle:(nonnull NMFMapView *)mapView {
100101
if (((RNNaverMapView*)self).onCameraChange != nil)
101102
((RNNaverMapView*)self).onCameraChange(@{
102-
@"latitude" : @(mapView.cameraPosition.target.lat),
103-
@"longitude": @(mapView.cameraPosition.target.lng),
104-
@"zoom" : @(mapView.cameraPosition.zoom)
103+
@"latitude" : @(mapView.cameraPosition.target.lat),
104+
@"longitude" : @(mapView.cameraPosition.target.lng),
105+
@"zoom" : @(mapView.cameraPosition.zoom),
106+
@"contentRegion" : pointsToJson(mapView.contentRegion.exteriorRing.points),
107+
@"coveringRegion": pointsToJson(mapView.coveringRegion.exteriorRing.points),
105108
});
106109
}
107110

111+
static NSArray* pointsToJson(NSArray<NMGLatLng*> *points) {
112+
NSMutableArray *array = [NSMutableArray array];
113+
for (int i = 0; i < points.count; i++)
114+
[array addObject: toJson(points[i])];
115+
return array;
116+
}
117+
118+
static NSDictionary* toJson(NMGLatLng * _Nonnull latlng) {
119+
return @{
120+
@"latitude" : @(latlng.lat),
121+
@"longitude": @(latlng.lng),
122+
};
123+
}
124+
108125
- (void)didTapMapView:(CGPoint)point LatLng:(NMGLatLng *)latlng {
109126
if (((RNNaverMapView*)self).onMapClick != nil)
110127
((RNNaverMapView*)self).onMapClick(@{
@@ -123,4 +140,6 @@ - (void)mapView:(nonnull NMFMapView *)mapView regionWillChangeAnimated:(BOOL)ani
123140
});
124141
}
125142

143+
144+
126145
@end

0 commit comments

Comments
 (0)