react-native-map4d-map-dtqg 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -0
- package/android/.gradle/9.2.0/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -2
- package/android/build.gradle +23 -2
- package/android/src/main/java/com/reactnativemap4dmap/Map4dMapModule.java +39 -27
- package/ios/Map4dMap.h +12 -3
- package/ios/Map4dMap.m +108 -3
- package/ios/Map4dMapTurbo.mm +16 -0
- package/ios/RMFCircleManager.m +40 -68
- package/ios/RMFDirectionsRendererManager.m +26 -24
- package/ios/RMFMapViewManager.m +64 -149
- package/ios/RMFMarkerManager.m +36 -64
- package/ios/RMFPOIManager.m +40 -74
- package/ios/RMFPolygonManager.m +38 -60
- package/ios/RMFPolylineManager.m +36 -58
- package/ios/building/RMFBuildingManager.m +36 -64
- package/lib/commonjs/components/MFBanDoSo/constants.js +30 -0
- package/lib/commonjs/components/MFBanDoSo/constants.js.map +1 -0
- package/lib/commonjs/components/MFBanDoSo/helpers.js +200 -0
- package/lib/commonjs/components/MFBanDoSo/helpers.js.map +1 -0
- package/lib/commonjs/components/MFBanDoSo/propTypes.js +18 -0
- package/lib/commonjs/components/MFBanDoSo/propTypes.js.map +1 -0
- package/lib/commonjs/components/MFBanDoSo/styles.js +334 -0
- package/lib/commonjs/components/MFBanDoSo/styles.js.map +1 -0
- package/lib/commonjs/components/MFBanDoSo/ui.js +231 -0
- package/lib/commonjs/components/MFBanDoSo/ui.js.map +1 -0
- package/lib/commonjs/components/MFBanDoSo.js +201 -73
- package/lib/commonjs/components/MFBanDoSo.js.map +1 -1
- package/lib/commonjs/components/MFBuilding.js +15 -90
- package/lib/commonjs/components/MFBuilding.js.map +1 -1
- package/lib/commonjs/components/MFCircle.js +20 -88
- package/lib/commonjs/components/MFCircle.js.map +1 -1
- package/lib/commonjs/components/MFDirectionsRenderer.js +15 -93
- package/lib/commonjs/components/MFDirectionsRenderer.js.map +1 -1
- package/lib/commonjs/components/MFMapView.js +50 -147
- package/lib/commonjs/components/MFMapView.js.map +1 -1
- package/lib/commonjs/components/MFMarker.js +15 -101
- package/lib/commonjs/components/MFMarker.js.map +1 -1
- package/lib/commonjs/components/MFPOI.js +17 -92
- package/lib/commonjs/components/MFPOI.js.map +1 -1
- package/lib/commonjs/components/MFPolygon.js +15 -87
- package/lib/commonjs/components/MFPolygon.js.map +1 -1
- package/lib/commonjs/components/MFPolyline.js +17 -87
- package/lib/commonjs/components/MFPolyline.js.map +1 -1
- package/lib/commonjs/components/MFTileOverlay.js +7 -15
- package/lib/commonjs/components/MFTileOverlay.js.map +1 -1
- package/lib/commonjs/components/Map4dMapView.js +1 -4
- package/lib/commonjs/components/Map4dMapView.js.map +1 -1
- package/lib/commonjs/components/extends/AreaFocusManager.js +4 -38
- package/lib/commonjs/components/extends/AreaFocusManager.js.map +1 -1
- package/lib/commonjs/components/extends/AreaFocuser.js +1 -17
- package/lib/commonjs/components/extends/AreaFocuser.js.map +1 -1
- package/lib/commonjs/components/extends/BoundHelper.js +0 -6
- package/lib/commonjs/components/extends/BoundHelper.js.map +1 -1
- package/lib/commonjs/components/extends/area/AreaFocusAreas.js +0 -37
- package/lib/commonjs/components/extends/area/AreaFocusAreas.js.map +1 -1
- package/lib/commonjs/components/extends/area/AreaFocusGeometryUtils.js +1 -35
- package/lib/commonjs/components/extends/area/AreaFocusGeometryUtils.js.map +1 -1
- package/lib/commonjs/components/extends/area/AreaFocusSession.js +0 -18
- package/lib/commonjs/components/extends/area/AreaFocusSession.js.map +1 -1
- package/lib/commonjs/components/extends/area/AreaFocusTypes.js +2 -3
- package/lib/commonjs/components/extends/area/AreaFocusTypes.js.map +1 -1
- package/lib/commonjs/components/internal/DefaultRoadmapStyle.js +1 -2
- package/lib/commonjs/components/internal/DefaultRoadmapStyle.js.map +1 -1
- package/lib/commonjs/components/internal/GeojsonStyleUtils.js +20 -31
- package/lib/commonjs/components/internal/GeojsonStyleUtils.js.map +1 -1
- package/lib/commonjs/index.js +0 -11
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/native/Map4dMapNativeModule.js +10 -0
- package/lib/commonjs/native/Map4dMapNativeModule.js.map +1 -0
- package/lib/commonjs/native/NativeModuleResolver.js +35 -0
- package/lib/commonjs/native/NativeModuleResolver.js.map +1 -0
- package/lib/commonjs/native/ViewManagerCommand.js +67 -0
- package/lib/commonjs/native/ViewManagerCommand.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/specs/NativeMap4dMap.js +9 -0
- package/lib/commonjs/specs/NativeMap4dMap.js.map +1 -0
- package/lib/module/components/MFBanDoSo/constants.js +25 -0
- package/lib/module/components/MFBanDoSo/constants.js.map +1 -0
- package/lib/module/components/MFBanDoSo/helpers.js +188 -0
- package/lib/module/components/MFBanDoSo/helpers.js.map +1 -0
- package/lib/module/components/MFBanDoSo/propTypes.js +14 -0
- package/lib/module/components/MFBanDoSo/propTypes.js.map +1 -0
- package/lib/module/components/MFBanDoSo/styles.js +332 -0
- package/lib/module/components/MFBanDoSo/styles.js.map +1 -0
- package/lib/module/components/MFBanDoSo/ui.js +224 -0
- package/lib/module/components/MFBanDoSo/ui.js.map +1 -0
- package/lib/module/components/MFBanDoSo.js +203 -63
- package/lib/module/components/MFBanDoSo.js.map +1 -1
- package/lib/module/components/MFBuilding.js +17 -82
- package/lib/module/components/MFBuilding.js.map +1 -1
- package/lib/module/components/MFCircle.js +22 -80
- package/lib/module/components/MFCircle.js.map +1 -1
- package/lib/module/components/MFDirectionsRenderer.js +16 -85
- package/lib/module/components/MFDirectionsRenderer.js.map +1 -1
- package/lib/module/components/MFMapView.js +51 -136
- package/lib/module/components/MFMapView.js.map +1 -1
- package/lib/module/components/MFMarker.js +17 -92
- package/lib/module/components/MFMarker.js.map +1 -1
- package/lib/module/components/MFPOI.js +19 -84
- package/lib/module/components/MFPOI.js.map +1 -1
- package/lib/module/components/MFPolygon.js +17 -79
- package/lib/module/components/MFPolygon.js.map +1 -1
- package/lib/module/components/MFPolyline.js +19 -79
- package/lib/module/components/MFPolyline.js.map +1 -1
- package/lib/module/components/MFTileOverlay.js +10 -9
- package/lib/module/components/MFTileOverlay.js.map +1 -1
- package/lib/module/components/Map4dMapView.js +2 -0
- package/lib/module/components/Map4dMapView.js.map +1 -1
- package/lib/module/components/extends/AreaFocusManager.js +6 -32
- package/lib/module/components/extends/AreaFocusManager.js.map +1 -1
- package/lib/module/components/extends/AreaFocuser.js +3 -15
- package/lib/module/components/extends/AreaFocuser.js.map +1 -1
- package/lib/module/components/extends/BoundHelper.js +2 -5
- package/lib/module/components/extends/BoundHelper.js.map +1 -1
- package/lib/module/components/extends/area/AreaFocusAreas.js +2 -33
- package/lib/module/components/extends/area/AreaFocusAreas.js.map +1 -1
- package/lib/module/components/extends/area/AreaFocusGeometryUtils.js +2 -32
- package/lib/module/components/extends/area/AreaFocusGeometryUtils.js.map +1 -1
- package/lib/module/components/extends/area/AreaFocusSession.js +2 -17
- package/lib/module/components/extends/area/AreaFocusSession.js.map +1 -1
- package/lib/module/components/extends/area/AreaFocusTypes.js +3 -0
- package/lib/module/components/extends/area/AreaFocusTypes.js.map +1 -1
- package/lib/module/components/internal/DefaultRoadmapStyle.js +2 -0
- package/lib/module/components/internal/DefaultRoadmapStyle.js.map +1 -1
- package/lib/module/components/internal/GeojsonStyleUtils.js +21 -28
- package/lib/module/components/internal/GeojsonStyleUtils.js.map +1 -1
- package/lib/module/index.js +2 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/native/Map4dMapNativeModule.js +5 -0
- package/lib/module/native/Map4dMapNativeModule.js.map +1 -0
- package/lib/module/native/NativeModuleResolver.js +29 -0
- package/lib/module/native/NativeModuleResolver.js.map +1 -0
- package/lib/module/native/ViewManagerCommand.js +61 -0
- package/lib/module/native/ViewManagerCommand.js.map +1 -0
- package/lib/module/specs/NativeMap4dMap.js +5 -0
- package/lib/module/specs/NativeMap4dMap.js.map +1 -0
- package/lib/typescript/components/MFBanDoSo/constants.d.ts +11 -0
- package/lib/typescript/components/MFBanDoSo/constants.d.ts.map +1 -0
- package/lib/typescript/components/MFBanDoSo/helpers.d.ts +14 -0
- package/lib/typescript/components/MFBanDoSo/helpers.d.ts.map +1 -0
- package/lib/typescript/components/MFBanDoSo/propTypes.d.ts +2 -0
- package/lib/typescript/components/MFBanDoSo/propTypes.d.ts.map +1 -0
- package/lib/typescript/components/MFBanDoSo/styles.d.ts +336 -0
- package/lib/typescript/components/MFBanDoSo/styles.d.ts.map +1 -0
- package/lib/typescript/components/MFBanDoSo/ui.d.ts +32 -0
- package/lib/typescript/components/MFBanDoSo/ui.d.ts.map +1 -0
- package/lib/typescript/components/MFBanDoSo.d.ts +38 -0
- package/lib/typescript/components/MFBanDoSo.d.ts.map +1 -0
- package/lib/typescript/components/MFBuilding.d.ts +24 -0
- package/lib/typescript/components/MFBuilding.d.ts.map +1 -0
- package/lib/typescript/components/MFCircle.d.ts +24 -0
- package/lib/typescript/components/MFCircle.d.ts.map +1 -0
- package/lib/typescript/components/MFDirectionsRenderer.d.ts +19 -0
- package/lib/typescript/components/MFDirectionsRenderer.d.ts.map +1 -0
- package/lib/typescript/components/MFMapView.d.ts +66 -0
- package/lib/typescript/components/MFMapView.d.ts.map +1 -0
- package/lib/typescript/components/MFMarker.d.ts +26 -0
- package/lib/typescript/components/MFMarker.d.ts.map +1 -0
- package/lib/typescript/components/MFPOI.d.ts +24 -0
- package/lib/typescript/components/MFPOI.d.ts.map +1 -0
- package/lib/typescript/components/MFPolygon.d.ts +24 -0
- package/lib/typescript/components/MFPolygon.d.ts.map +1 -0
- package/lib/typescript/components/MFPolyline.d.ts +24 -0
- package/lib/typescript/components/MFPolyline.d.ts.map +1 -0
- package/lib/typescript/components/MFTileOverlay.d.ts +12 -0
- package/lib/typescript/components/MFTileOverlay.d.ts.map +1 -0
- package/lib/typescript/components/Map4dMapView.d.ts +8 -7
- package/lib/typescript/components/Map4dMapView.d.ts.map +1 -0
- package/lib/typescript/components/extends/AreaFocusManager.d.ts +34 -0
- package/lib/typescript/components/extends/AreaFocusManager.d.ts.map +1 -0
- package/lib/typescript/components/extends/AreaFocuser.d.ts +15 -0
- package/lib/typescript/components/extends/AreaFocuser.d.ts.map +1 -0
- package/lib/typescript/components/extends/BoundHelper.d.ts +11 -0
- package/lib/typescript/components/extends/BoundHelper.d.ts.map +1 -0
- package/lib/typescript/components/extends/area/AreaFocusAreas.d.ts +58 -0
- package/lib/typescript/components/extends/area/AreaFocusAreas.d.ts.map +1 -0
- package/lib/typescript/components/extends/area/AreaFocusGeometryUtils.d.ts +19 -0
- package/lib/typescript/components/extends/area/AreaFocusGeometryUtils.d.ts.map +1 -0
- package/lib/typescript/components/extends/area/AreaFocusSession.d.ts +14 -0
- package/lib/typescript/components/extends/area/AreaFocusSession.d.ts.map +1 -0
- package/lib/typescript/components/extends/area/AreaFocusTypes.d.ts +40 -0
- package/lib/typescript/components/extends/area/AreaFocusTypes.d.ts.map +1 -0
- package/lib/typescript/components/internal/DefaultRoadmapStyle.d.ts +820 -0
- package/lib/typescript/components/internal/DefaultRoadmapStyle.d.ts.map +1 -0
- package/lib/typescript/components/internal/GeojsonStyleUtils.d.ts +3 -0
- package/lib/typescript/components/internal/GeojsonStyleUtils.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +13 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/native/Map4dMapNativeModule.d.ts +2 -0
- package/lib/typescript/native/Map4dMapNativeModule.d.ts.map +1 -0
- package/lib/typescript/native/NativeModuleResolver.d.ts +3 -0
- package/lib/typescript/native/NativeModuleResolver.d.ts.map +1 -0
- package/lib/typescript/native/ViewManagerCommand.d.ts +11 -0
- package/lib/typescript/native/ViewManagerCommand.d.ts.map +1 -0
- package/package.json +27 -11
- package/src/components/MFBanDoSo/constants.js +38 -0
- package/src/components/MFBanDoSo/helpers.js +273 -0
- package/src/components/MFBanDoSo/propTypes.js +14 -0
- package/src/components/MFBanDoSo/styles.js +323 -0
- package/src/components/MFBanDoSo/ui.js +261 -0
- package/src/components/MFBanDoSo.js +280 -78
- package/src/components/MFBuilding.js +8 -48
- package/src/components/MFCircle.js +8 -48
- package/src/components/MFDirectionsRenderer.js +8 -47
- package/src/components/MFMapView.js +31 -53
- package/src/components/MFMarker.js +9 -50
- package/src/components/MFPOI.js +8 -48
- package/src/components/MFPolygon.js +8 -48
- package/src/components/MFPolyline.js +8 -48
- package/src/components/internal/GeojsonStyleUtils.js +3 -0
- package/src/native/Map4dMapNativeModule.js +3 -0
- package/src/native/NativeModuleResolver.js +33 -0
- package/src/native/ViewManagerCommand.js +82 -0
- package/src/specs/NativeMap4dMap.js +12 -0
- package/ios/Map4dMapViewManager.m +0 -34
package/ios/RMFMapViewManager.m
CHANGED
|
@@ -31,6 +31,35 @@
|
|
|
31
31
|
|
|
32
32
|
RCT_EXPORT_MODULE(RMFMapView)
|
|
33
33
|
|
|
34
|
+
- (void)withMapViewForTag:(nonnull NSNumber *)reactTag
|
|
35
|
+
rejecter:(RCTPromiseRejectBlock)reject
|
|
36
|
+
handler:(void (^)(RMFMapView *mapView))handler
|
|
37
|
+
{
|
|
38
|
+
RCTUIManager *uiManager = self.bridge.uiManager;
|
|
39
|
+
if (uiManager == nil) {
|
|
40
|
+
if (reject) {
|
|
41
|
+
reject(@"E_UI_MANAGER_UNAVAILABLE", @"UIManager is unavailable on iOS runtime", nil);
|
|
42
|
+
} else {
|
|
43
|
+
RCTLogError(@"UIManager is unavailable on iOS runtime");
|
|
44
|
+
}
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
[uiManager addUIBlock:^(__unused RCTUIManager *manager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
49
|
+
id view = viewRegistry[reactTag];
|
|
50
|
+
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
51
|
+
if (reject) {
|
|
52
|
+
reject(@"E_INVALID_VIEW", [NSString stringWithFormat:@"Invalid view returned from registry, expecting RMFMapView, got: %@", view], nil);
|
|
53
|
+
} else {
|
|
54
|
+
RCTLogError(@"Invalid view returned from registry, expecting RMFMapView, got: %@", view);
|
|
55
|
+
}
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
handler((RMFMapView *)view);
|
|
60
|
+
}];
|
|
61
|
+
}
|
|
62
|
+
|
|
34
63
|
- (UIView *)view {
|
|
35
64
|
RMFMapView * rMap = [[RMFMapView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];
|
|
36
65
|
// RMFMapView * rMap = [[RMFMapView alloc] init];
|
|
@@ -79,15 +108,9 @@ RCT_EXPORT_METHOD(getCamera:(nonnull NSNumber *)reactTag
|
|
|
79
108
|
resolver: (RCTPromiseResolveBlock)resolve
|
|
80
109
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
81
110
|
{
|
|
82
|
-
[self
|
|
83
|
-
id view = viewRegistry[reactTag];
|
|
84
|
-
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
85
|
-
reject(@"Invalid argument", [NSString stringWithFormat:@"Invalid view returned from registry, expecting RMFMapView, got: %@", view], NULL);
|
|
86
|
-
} else {
|
|
87
|
-
RMFMapView *mapView = (RMFMapView *)view;
|
|
111
|
+
[self withMapViewForTag:reactTag rejecter:reject handler:^(RMFMapView *mapView) {
|
|
88
112
|
MFCameraPosition *camera = [mapView camera];
|
|
89
113
|
resolve([RMFEventResponse fromCameraPosition:camera]);
|
|
90
|
-
}
|
|
91
114
|
}];
|
|
92
115
|
}
|
|
93
116
|
|
|
@@ -95,15 +118,9 @@ RCT_EXPORT_METHOD(getBounds:(nonnull NSNumber *)reactTag
|
|
|
95
118
|
resolver: (RCTPromiseResolveBlock)resolve
|
|
96
119
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
97
120
|
{
|
|
98
|
-
[self
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
reject(@"Invalid argument", [NSString stringWithFormat:@"Invalid view returned from registry, expecting RMFMapView, got: %@", view], NULL);
|
|
102
|
-
} else {
|
|
103
|
-
RMFMapView *mapView = (RMFMapView *)view;
|
|
104
|
-
MFCoordinateBounds* bounds = [mapView getBounds];
|
|
105
|
-
resolve([RMFEventResponse fromCoordinateBounds:bounds]);
|
|
106
|
-
}
|
|
121
|
+
[self withMapViewForTag:reactTag rejecter:reject handler:^(RMFMapView *mapView) {
|
|
122
|
+
MFCoordinateBounds* bounds = [mapView getBounds];
|
|
123
|
+
resolve([RMFEventResponse fromCoordinateBounds:bounds]);
|
|
107
124
|
}];
|
|
108
125
|
}
|
|
109
126
|
|
|
@@ -112,38 +129,27 @@ RCT_EXPORT_METHOD(cameraForBounds:(nonnull NSNumber *)reactTag
|
|
|
112
129
|
resolver: (RCTPromiseResolveBlock)resolve
|
|
113
130
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
114
131
|
{
|
|
115
|
-
[self
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
UIEdgeInsets insets = [RCTConvert UIEdgeInsets:data[@"padding"]];
|
|
127
|
-
camera = [mapView cameraForBounds:bounds insets:insets];
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
camera = [mapView cameraForBounds:bounds];
|
|
131
|
-
}
|
|
132
|
+
[self withMapViewForTag:reactTag rejecter:reject handler:^(RMFMapView *mapView) {
|
|
133
|
+
MFCameraPosition *camera = nil;
|
|
134
|
+
id data = [RCTConvert NSDictionary:json];
|
|
135
|
+
if (data[@"bounds"]) {
|
|
136
|
+
MFCoordinateBounds* bounds = [RCTConvert MFCoordinateBounds:data[@"bounds"]];
|
|
137
|
+
if (data[@"padding"]) {
|
|
138
|
+
UIEdgeInsets insets = [RCTConvert UIEdgeInsets:data[@"padding"]];
|
|
139
|
+
camera = [mapView cameraForBounds:bounds insets:insets];
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
camera = [mapView cameraForBounds:bounds];
|
|
132
143
|
}
|
|
133
|
-
resolve([RMFEventResponse fromCameraPosition:camera]);
|
|
134
144
|
}
|
|
145
|
+
resolve([RMFEventResponse fromCameraPosition:camera]);
|
|
135
146
|
}];
|
|
136
147
|
}
|
|
137
148
|
|
|
138
149
|
RCT_EXPORT_METHOD(fitBounds:(nonnull NSNumber *)reactTag
|
|
139
150
|
withData:(id)json)
|
|
140
151
|
{
|
|
141
|
-
[self
|
|
142
|
-
id view = viewRegistry[reactTag];
|
|
143
|
-
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
144
|
-
RCTLogError(@"Invalid view returned from registry, expecting RMFMapView, got: %@", view);
|
|
145
|
-
} else {
|
|
146
|
-
RMFMapView *mapView = (RMFMapView *)view;
|
|
152
|
+
[self withMapViewForTag:reactTag rejecter:nil handler:^(RMFMapView *mapView) {
|
|
147
153
|
MFCameraPosition* camera = nil;
|
|
148
154
|
id data = [RCTConvert NSDictionary:json];
|
|
149
155
|
if (data[@"bounds"]) {
|
|
@@ -157,7 +163,6 @@ RCT_EXPORT_METHOD(fitBounds:(nonnull NSNumber *)reactTag
|
|
|
157
163
|
}
|
|
158
164
|
[mapView moveCamera:[MFCameraUpdate setCamera:camera]];
|
|
159
165
|
}
|
|
160
|
-
}
|
|
161
166
|
}];
|
|
162
167
|
}
|
|
163
168
|
|
|
@@ -166,15 +171,9 @@ RCT_EXPORT_METHOD(pointForCoordinate:(nonnull NSNumber *)reactTag
|
|
|
166
171
|
resolver: (RCTPromiseResolveBlock)resolve
|
|
167
172
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
168
173
|
{
|
|
169
|
-
[self
|
|
170
|
-
id view = viewRegistry[reactTag];
|
|
171
|
-
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
172
|
-
reject(@"Invalid argument", [NSString stringWithFormat:@"Invalid view returned from registry, expecting RMFMapView, got: %@", view], NULL);
|
|
173
|
-
} else {
|
|
174
|
-
RMFMapView *mapView = (RMFMapView *)view;
|
|
174
|
+
[self withMapViewForTag:reactTag rejecter:reject handler:^(RMFMapView *mapView) {
|
|
175
175
|
CGPoint point = [mapView.projection pointForCoordinate:[RCTConvert CLLocationCoordinate2D:json]];
|
|
176
176
|
resolve([RMFEventResponse fromCGPoint:point]);
|
|
177
|
-
}
|
|
178
177
|
}];
|
|
179
178
|
}
|
|
180
179
|
|
|
@@ -183,67 +182,37 @@ RCT_EXPORT_METHOD(coordinateForPoint:(nonnull NSNumber *)reactTag
|
|
|
183
182
|
resolver: (RCTPromiseResolveBlock)resolve
|
|
184
183
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
185
184
|
{
|
|
186
|
-
[self
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
reject(@"Invalid argument", [NSString stringWithFormat:@"Invalid view returned from registry, expecting RMFMapView, got: %@", view], NULL);
|
|
190
|
-
} else {
|
|
191
|
-
RMFMapView *mapView = (RMFMapView *)view;
|
|
192
|
-
CLLocationCoordinate2D coordinate = [mapView.projection coordinateForPoint:[RCTConvert CGPoint:json]];
|
|
193
|
-
resolve([RMFEventResponse fromCoordinate:coordinate]);
|
|
194
|
-
}
|
|
185
|
+
[self withMapViewForTag:reactTag rejecter:reject handler:^(RMFMapView *mapView) {
|
|
186
|
+
CLLocationCoordinate2D coordinate = [mapView.projection coordinateForPoint:[RCTConvert CGPoint:json]];
|
|
187
|
+
resolve([RMFEventResponse fromCoordinate:coordinate]);
|
|
195
188
|
}];
|
|
196
189
|
}
|
|
197
190
|
|
|
198
191
|
RCT_EXPORT_METHOD(animateCamera:(nonnull NSNumber *)reactTag
|
|
199
192
|
withCamera:(id)json) {
|
|
200
|
-
[self
|
|
201
|
-
id view = viewRegistry[reactTag];
|
|
202
|
-
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
203
|
-
RCTLogError(@"Invalid view returned from registry, expecting RMFMapView, got: %@", view);
|
|
204
|
-
} else {
|
|
205
|
-
RMFMapView *mapView = (RMFMapView *)view;
|
|
193
|
+
[self withMapViewForTag:reactTag rejecter:nil handler:^(RMFMapView *mapView) {
|
|
206
194
|
[mapView animateCamera:[MFCameraUpdate setCamera:[RCTConvert MFCameraPosition:json withDefaultCamera:mapView.camera]]];
|
|
207
|
-
}
|
|
208
195
|
}];
|
|
209
196
|
}
|
|
210
197
|
|
|
211
198
|
RCT_EXPORT_METHOD(moveCamera:(nonnull NSNumber *)reactTag
|
|
212
199
|
withCamera:(id)json) {
|
|
213
|
-
[self
|
|
214
|
-
id view = viewRegistry[reactTag];
|
|
215
|
-
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
216
|
-
RCTLogError(@"Invalid view returned from registry, expecting RMFMapView, got: %@", view);
|
|
217
|
-
} else {
|
|
218
|
-
RMFMapView *mapView = (RMFMapView *)view;
|
|
200
|
+
[self withMapViewForTag:reactTag rejecter:nil handler:^(RMFMapView *mapView) {
|
|
219
201
|
[mapView moveCamera:[MFCameraUpdate setCamera:[RCTConvert MFCameraPosition:json withDefaultCamera:mapView.camera]]];
|
|
220
|
-
}
|
|
221
202
|
}];
|
|
222
203
|
}
|
|
223
204
|
|
|
224
205
|
RCT_EXPORT_METHOD(showsMyLocationButton:(nonnull NSNumber *)reactTag
|
|
225
206
|
enable:(BOOL)enable) {
|
|
226
|
-
[self
|
|
227
|
-
id view = viewRegistry[reactTag];
|
|
228
|
-
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
229
|
-
|
|
230
|
-
} else {
|
|
231
|
-
RMFMapView *mapView = (RMFMapView *)view;
|
|
207
|
+
[self withMapViewForTag:reactTag rejecter:nil handler:^(RMFMapView *mapView) {
|
|
232
208
|
mapView.settings.myLocationButton = enable;
|
|
233
|
-
}
|
|
234
209
|
}];
|
|
235
210
|
}
|
|
236
211
|
|
|
237
212
|
RCT_EXPORT_METHOD(setMyLocationEnabled:(nonnull NSNumber *)reactTag
|
|
238
213
|
enable:(BOOL)enable) {
|
|
239
|
-
[self
|
|
240
|
-
id view = viewRegistry[reactTag];
|
|
241
|
-
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
242
|
-
|
|
243
|
-
} else {
|
|
244
|
-
RMFMapView *mapView = (RMFMapView *)view;
|
|
214
|
+
[self withMapViewForTag:reactTag rejecter:nil handler:^(RMFMapView *mapView) {
|
|
245
215
|
[mapView setMyLocationEnabled:enable];
|
|
246
|
-
}
|
|
247
216
|
}];
|
|
248
217
|
}
|
|
249
218
|
|
|
@@ -251,126 +220,72 @@ RCT_EXPORT_METHOD(getMyLocation:(nonnull NSNumber *)reactTag
|
|
|
251
220
|
resolver: (RCTPromiseResolveBlock)resolve
|
|
252
221
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
253
222
|
{
|
|
254
|
-
[self
|
|
255
|
-
id view = viewRegistry[reactTag];
|
|
256
|
-
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
257
|
-
reject(@"Invalid argument", [NSString stringWithFormat:@"Invalid view returned from registry, expecting RMFMapView, got: %@", view], NULL);
|
|
258
|
-
} else {
|
|
259
|
-
RMFMapView *mapView = (RMFMapView *)view;
|
|
223
|
+
[self withMapViewForTag:reactTag rejecter:reject handler:^(RMFMapView *mapView) {
|
|
260
224
|
CLLocation *location = [mapView getMyLocation];
|
|
261
225
|
resolve([RMFEventResponse fromCLLocation:location]);
|
|
262
|
-
}
|
|
263
226
|
}];
|
|
264
227
|
}
|
|
265
228
|
|
|
266
229
|
RCT_EXPORT_METHOD(setPOIsEnabled:(nonnull NSNumber *)reactTag
|
|
267
230
|
enable:(BOOL)enable) {
|
|
268
|
-
[self
|
|
269
|
-
|
|
270
|
-
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
271
|
-
|
|
272
|
-
} else {
|
|
273
|
-
RMFMapView *mapView = (RMFMapView *)view;
|
|
274
|
-
[mapView setPOIsEnabled:enable];
|
|
275
|
-
}
|
|
231
|
+
[self withMapViewForTag:reactTag rejecter:nil handler:^(RMFMapView *mapView) {
|
|
232
|
+
[mapView setPOIsEnabled:enable];
|
|
276
233
|
}];
|
|
277
234
|
}
|
|
278
235
|
|
|
279
236
|
RCT_EXPORT_METHOD(setTime:(nonnull NSNumber *)reactTag
|
|
280
237
|
withTime:(id)json) {
|
|
281
|
-
[self
|
|
282
|
-
id view = viewRegistry[reactTag];
|
|
283
|
-
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
284
|
-
|
|
285
|
-
} else {
|
|
286
|
-
RMFMapView *mapView = (RMFMapView *)view;
|
|
238
|
+
[self withMapViewForTag:reactTag rejecter:nil handler:^(RMFMapView *mapView) {
|
|
287
239
|
NSDate * date = [RCTConvert NSDate:json];
|
|
288
240
|
if (date) {
|
|
289
241
|
[mapView setTime:date];
|
|
290
242
|
}
|
|
291
|
-
}
|
|
292
243
|
}];
|
|
293
244
|
}
|
|
294
245
|
|
|
295
246
|
RCT_EXPORT_METHOD(setMapStyle:(nonnull NSNumber *)reactTag
|
|
296
247
|
withStyle:(NSString *)style) {
|
|
297
|
-
[self
|
|
298
|
-
id view = viewRegistry[reactTag];
|
|
299
|
-
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
300
|
-
|
|
301
|
-
} else {
|
|
302
|
-
RMFMapView *mapView = (RMFMapView *)view;
|
|
248
|
+
[self withMapViewForTag:reactTag rejecter:nil handler:^(RMFMapView *mapView) {
|
|
303
249
|
if (style.length > 0) {
|
|
304
250
|
MFMapStyle *mapStyle = [[MFMapStyle alloc] initWithJSONString:style];
|
|
305
251
|
[mapView setMapStyle:mapStyle];
|
|
306
252
|
}
|
|
307
|
-
}
|
|
308
253
|
}];
|
|
309
254
|
}
|
|
310
255
|
|
|
311
256
|
|
|
312
257
|
RCT_EXPORT_METHOD(setZoomGesturesEnabled:(nonnull NSNumber *)reactTag
|
|
313
258
|
enable:(BOOL)enable) {
|
|
314
|
-
[self
|
|
315
|
-
id view = viewRegistry[reactTag];
|
|
316
|
-
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
317
|
-
|
|
318
|
-
} else {
|
|
319
|
-
RMFMapView *mapView = (RMFMapView *)view;
|
|
259
|
+
[self withMapViewForTag:reactTag rejecter:nil handler:^(RMFMapView *mapView) {
|
|
320
260
|
mapView.settings.zoomGestures = enable;
|
|
321
|
-
}
|
|
322
261
|
}];
|
|
323
262
|
}
|
|
324
263
|
|
|
325
264
|
RCT_EXPORT_METHOD(setScrollGesturesEnabled:(nonnull NSNumber *)reactTag
|
|
326
265
|
enable:(BOOL)enable) {
|
|
327
|
-
[self
|
|
328
|
-
id view = viewRegistry[reactTag];
|
|
329
|
-
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
330
|
-
|
|
331
|
-
} else {
|
|
332
|
-
RMFMapView *mapView = (RMFMapView *)view;
|
|
266
|
+
[self withMapViewForTag:reactTag rejecter:nil handler:^(RMFMapView *mapView) {
|
|
333
267
|
mapView.settings.scrollGestures = enable;
|
|
334
|
-
}
|
|
335
268
|
}];
|
|
336
269
|
}
|
|
337
270
|
|
|
338
271
|
RCT_EXPORT_METHOD(setRotateGesturesEnabled:(nonnull NSNumber *)reactTag
|
|
339
272
|
enable:(BOOL)enable) {
|
|
340
|
-
[self
|
|
341
|
-
id view = viewRegistry[reactTag];
|
|
342
|
-
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
343
|
-
|
|
344
|
-
} else {
|
|
345
|
-
RMFMapView *mapView = (RMFMapView *)view;
|
|
273
|
+
[self withMapViewForTag:reactTag rejecter:nil handler:^(RMFMapView *mapView) {
|
|
346
274
|
mapView.settings.rotateGestures = enable;
|
|
347
|
-
}
|
|
348
275
|
}];
|
|
349
276
|
}
|
|
350
277
|
|
|
351
278
|
RCT_EXPORT_METHOD(setTiltGesturesEnabled:(nonnull NSNumber *)reactTag
|
|
352
279
|
enable:(BOOL)enable) {
|
|
353
|
-
[self
|
|
354
|
-
id view = viewRegistry[reactTag];
|
|
355
|
-
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
356
|
-
|
|
357
|
-
} else {
|
|
358
|
-
RMFMapView *mapView = (RMFMapView *)view;
|
|
280
|
+
[self withMapViewForTag:reactTag rejecter:nil handler:^(RMFMapView *mapView) {
|
|
359
281
|
mapView.settings.tiltGestures = enable;
|
|
360
|
-
}
|
|
361
282
|
}];
|
|
362
283
|
}
|
|
363
284
|
|
|
364
285
|
RCT_EXPORT_METHOD(setAllGesturesEnabled:(nonnull NSNumber *)reactTag
|
|
365
286
|
enable:(BOOL)enable) {
|
|
366
|
-
[self
|
|
367
|
-
id view = viewRegistry[reactTag];
|
|
368
|
-
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
369
|
-
|
|
370
|
-
} else {
|
|
371
|
-
RMFMapView *mapView = (RMFMapView *)view;
|
|
287
|
+
[self withMapViewForTag:reactTag rejecter:nil handler:^(RMFMapView *mapView) {
|
|
372
288
|
[mapView.settings setAllGesturesEnabled:enable];
|
|
373
|
-
}
|
|
374
289
|
}];
|
|
375
290
|
}
|
|
376
291
|
|
package/ios/RMFMarkerManager.m
CHANGED
|
@@ -16,6 +16,26 @@
|
|
|
16
16
|
|
|
17
17
|
RCT_EXPORT_MODULE(RMFMarker)
|
|
18
18
|
|
|
19
|
+
- (void)withMarkerForTag:(nonnull NSNumber *)reactTag
|
|
20
|
+
handler:(void (^)(RMFMarker *marker))handler
|
|
21
|
+
{
|
|
22
|
+
RCTUIManager *uiManager = self.bridge.uiManager;
|
|
23
|
+
if (uiManager == nil) {
|
|
24
|
+
RCTLogError(@"UIManager is unavailable on iOS runtime");
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
[uiManager addUIBlock:^(__unused RCTUIManager *manager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
29
|
+
id view = viewRegistry[reactTag];
|
|
30
|
+
if (![view isKindOfClass:[RMFMarker class]]) {
|
|
31
|
+
RCTLogError(@"Invalid view returned from registry, expecting RMFMarker, got: %@", view);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
handler((RMFMarker *)view);
|
|
36
|
+
}];
|
|
37
|
+
}
|
|
38
|
+
|
|
19
39
|
- (UIView *)view {
|
|
20
40
|
RMFMarker * marker = [[RMFMarker alloc] init];
|
|
21
41
|
return marker;
|
|
@@ -44,112 +64,64 @@ RCT_EXPORT_VIEW_PROPERTY(onDragEnd, RCTDirectEventBlock)
|
|
|
44
64
|
RCT_EXPORT_METHOD(setCoordinate:(nonnull NSNumber *)reactTag
|
|
45
65
|
withCoordinate:(id)coordinate)
|
|
46
66
|
{
|
|
47
|
-
[self
|
|
48
|
-
|
|
49
|
-
if (![view isKindOfClass:[RMFMarker class]]) {
|
|
50
|
-
RCTLogError(@"Invalid view returned from registry, expecting RMFMarker, got: %@", view);
|
|
51
|
-
} else {
|
|
52
|
-
RMFMarker *marker = (RMFMarker *)view;
|
|
53
|
-
[marker setCoordinate:[RCTConvert CLLocationCoordinate2D:coordinate]];
|
|
54
|
-
}
|
|
67
|
+
[self withMarkerForTag:reactTag handler:^(RMFMarker *marker) {
|
|
68
|
+
[marker setCoordinate:[RCTConvert CLLocationCoordinate2D:coordinate]];
|
|
55
69
|
}];
|
|
56
70
|
}
|
|
57
71
|
|
|
58
72
|
RCT_EXPORT_METHOD(setRotation:(nonnull NSNumber *)reactTag
|
|
59
73
|
rotation:(double)rotation)
|
|
60
74
|
{
|
|
61
|
-
[self
|
|
62
|
-
|
|
63
|
-
if (![view isKindOfClass:[RMFMarker class]]) {
|
|
64
|
-
RCTLogError(@"Invalid view returned from registry, expecting RMFMarker, got: %@", view);
|
|
65
|
-
} else {
|
|
66
|
-
RMFMarker *marker = (RMFMarker *)view;
|
|
67
|
-
[marker setRotation:rotation];
|
|
68
|
-
}
|
|
75
|
+
[self withMarkerForTag:reactTag handler:^(RMFMarker *marker) {
|
|
76
|
+
[marker setRotation:rotation];
|
|
69
77
|
}];
|
|
70
78
|
}
|
|
71
79
|
|
|
72
80
|
RCT_EXPORT_METHOD(setTitle:(nonnull NSNumber *)reactTag
|
|
73
81
|
title:(NSString*)title)
|
|
74
82
|
{
|
|
75
|
-
[self
|
|
76
|
-
|
|
77
|
-
if (![view isKindOfClass:[RMFMarker class]]) {
|
|
78
|
-
RCTLogError(@"Invalid view returned from registry, expecting RMFMarker, got: %@", view);
|
|
79
|
-
} else {
|
|
80
|
-
RMFMarker *marker = (RMFMarker *)view;
|
|
81
|
-
[marker setTitle:title];
|
|
82
|
-
}
|
|
83
|
+
[self withMarkerForTag:reactTag handler:^(RMFMarker *marker) {
|
|
84
|
+
[marker setTitle:title];
|
|
83
85
|
}];
|
|
84
86
|
}
|
|
85
87
|
|
|
86
88
|
RCT_EXPORT_METHOD(setSnippet:(nonnull NSNumber *)reactTag
|
|
87
89
|
snippet:(NSString*)snippet)
|
|
88
90
|
{
|
|
89
|
-
[self
|
|
90
|
-
|
|
91
|
-
if (![view isKindOfClass:[RMFMarker class]]) {
|
|
92
|
-
RCTLogError(@"Invalid view returned from registry, expecting RMFMarker, got: %@", view);
|
|
93
|
-
} else {
|
|
94
|
-
RMFMarker *marker = (RMFMarker *)view;
|
|
95
|
-
[marker setSnippet:snippet];
|
|
96
|
-
}
|
|
91
|
+
[self withMarkerForTag:reactTag handler:^(RMFMarker *marker) {
|
|
92
|
+
[marker setSnippet:snippet];
|
|
97
93
|
}];
|
|
98
94
|
}
|
|
99
95
|
|
|
100
96
|
RCT_EXPORT_METHOD(setDraggable:(nonnull NSNumber *)reactTag
|
|
101
97
|
draggable:(BOOL)draggable)
|
|
102
98
|
{
|
|
103
|
-
[self
|
|
104
|
-
|
|
105
|
-
if (![view isKindOfClass:[RMFMarker class]]) {
|
|
106
|
-
RCTLogError(@"Invalid view returned from registry, expecting RMFMarker, got: %@", view);
|
|
107
|
-
} else {
|
|
108
|
-
RMFMarker *marker = (RMFMarker *)view;
|
|
109
|
-
[marker setDraggable:draggable];
|
|
110
|
-
}
|
|
99
|
+
[self withMarkerForTag:reactTag handler:^(RMFMarker *marker) {
|
|
100
|
+
[marker setDraggable:draggable];
|
|
111
101
|
}];
|
|
112
102
|
}
|
|
113
103
|
|
|
114
104
|
RCT_EXPORT_METHOD(setZIndex:(nonnull NSNumber *)reactTag
|
|
115
105
|
zIndex:(float)zIndex)
|
|
116
106
|
{
|
|
117
|
-
[self
|
|
118
|
-
|
|
119
|
-
if (![view isKindOfClass:[RMFMarker class]]) {
|
|
120
|
-
RCTLogError(@"Invalid view returned from registry, expecting RMFMarker, got: %@", view);
|
|
121
|
-
} else {
|
|
122
|
-
RMFMarker *marker = (RMFMarker *)view;
|
|
123
|
-
[marker setZIndex:zIndex];
|
|
124
|
-
}
|
|
107
|
+
[self withMarkerForTag:reactTag handler:^(RMFMarker *marker) {
|
|
108
|
+
[marker setZIndex:zIndex];
|
|
125
109
|
}];
|
|
126
110
|
}
|
|
127
111
|
|
|
128
112
|
RCT_EXPORT_METHOD(setVisible:(nonnull NSNumber *)reactTag
|
|
129
113
|
visible:(BOOL)visible)
|
|
130
114
|
{
|
|
131
|
-
[self
|
|
132
|
-
|
|
133
|
-
if (![view isKindOfClass:[RMFMarker class]]) {
|
|
134
|
-
RCTLogError(@"Invalid view returned from registry, expecting RMFMarker, got: %@", view);
|
|
135
|
-
} else {
|
|
136
|
-
RMFMarker *marker = (RMFMarker *)view;
|
|
137
|
-
[marker setVisible:visible];
|
|
138
|
-
}
|
|
115
|
+
[self withMarkerForTag:reactTag handler:^(RMFMarker *marker) {
|
|
116
|
+
[marker setVisible:visible];
|
|
139
117
|
}];
|
|
140
118
|
}
|
|
141
119
|
|
|
142
120
|
RCT_EXPORT_METHOD(setUserData:(nonnull NSNumber *)reactTag
|
|
143
121
|
userData:(id)json)
|
|
144
122
|
{
|
|
145
|
-
[self
|
|
146
|
-
|
|
147
|
-
if (![view isKindOfClass:[RMFMarker class]]) {
|
|
148
|
-
RCTLogError(@"Invalid view returned from registry, expecting RMFMarker, got: %@", view);
|
|
149
|
-
} else {
|
|
150
|
-
RMFMarker *marker = (RMFMarker *)view;
|
|
151
|
-
[marker setUserData:[RCTConvert NSDictionary:json]];
|
|
152
|
-
}
|
|
123
|
+
[self withMarkerForTag:reactTag handler:^(RMFMarker *marker) {
|
|
124
|
+
[marker setUserData:[RCTConvert NSDictionary:json]];
|
|
153
125
|
}];
|
|
154
126
|
}
|
|
155
127
|
|