react-native-maps 1.21.0-alpha.12 → 1.21.0-alpha.121
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/android/build.gradle +77 -57
- package/android/gradlew +1 -2
- package/android/src/generated/RCTAppDependencyProvider.h +25 -0
- package/android/src/generated/RCTAppDependencyProvider.mm +55 -0
- package/android/src/generated/RCTModulesConformingToProtocolsProvider.h +18 -0
- package/android/src/generated/RCTModulesConformingToProtocolsProvider.mm +33 -0
- package/android/src/generated/RCTThirdPartyComponentsProvider.h +16 -0
- package/android/src/generated/RCTThirdPartyComponentsProvider.mm +26 -0
- package/android/src/generated/ReactAppDependencyProvider.podspec +34 -0
- package/android/src/generated/java/com/facebook/fbreact/specs/NativeAirMapsModuleSpec.java +63 -0
- package/android/src/generated/java/com/facebook/react/viewmanagers/RNMapsCalloutManagerDelegate.java +35 -0
- package/android/src/generated/java/com/facebook/react/viewmanagers/RNMapsCalloutManagerInterface.java +17 -0
- package/android/src/generated/java/com/facebook/react/viewmanagers/RNMapsCircleManagerDelegate.java +49 -0
- package/android/src/generated/java/com/facebook/react/viewmanagers/RNMapsCircleManagerInterface.java +23 -0
- package/android/src/generated/java/com/facebook/react/viewmanagers/RNMapsGooglePolygonManagerDelegate.java +49 -0
- package/android/src/generated/java/com/facebook/react/viewmanagers/RNMapsGooglePolygonManagerInterface.java +23 -0
- package/android/src/generated/java/com/facebook/react/viewmanagers/RNMapsMapViewManagerDelegate.java +206 -0
- package/android/src/generated/java/com/facebook/react/viewmanagers/RNMapsMapViewManagerInterface.java +73 -0
- package/android/src/generated/java/com/facebook/react/viewmanagers/RNMapsMarkerManagerDelegate.java +104 -0
- package/android/src/generated/java/com/facebook/react/viewmanagers/RNMapsMarkerManagerInterface.java +39 -0
- package/android/src/generated/java/com/facebook/react/viewmanagers/RNMapsOverlayManagerDelegate.java +46 -0
- package/android/src/generated/java/com/facebook/react/viewmanagers/RNMapsOverlayManagerInterface.java +23 -0
- package/android/src/generated/java/com/facebook/react/viewmanagers/RNMapsPolylineManagerDelegate.java +58 -0
- package/android/src/generated/java/com/facebook/react/viewmanagers/RNMapsPolylineManagerInterface.java +26 -0
- package/android/src/generated/jni/CMakeLists.txt +36 -0
- package/android/src/generated/jni/RNMapsSpecs-generated.cpp +68 -0
- package/android/src/generated/jni/RNMapsSpecs.h +31 -0
- package/android/src/generated/jni/react/renderer/components/RNMapsSpecs/ComponentDescriptors.cpp +29 -0
- package/android/src/generated/jni/react/renderer/components/RNMapsSpecs/ComponentDescriptors.h +31 -0
- package/android/src/generated/jni/react/renderer/components/RNMapsSpecs/EventEmitters.cpp +977 -0
- package/android/src/generated/jni/react/renderer/components/RNMapsSpecs/EventEmitters.h +846 -0
- package/android/src/generated/jni/react/renderer/components/RNMapsSpecs/Props.cpp +193 -0
- package/android/src/generated/jni/react/renderer/components/RNMapsSpecs/Props.h +1223 -0
- package/android/src/generated/jni/react/renderer/components/RNMapsSpecs/RNMapsSpecsJSI-generated.cpp +74 -0
- package/android/src/generated/jni/react/renderer/components/RNMapsSpecs/RNMapsSpecsJSI.h +268 -0
- package/android/src/generated/jni/react/renderer/components/RNMapsSpecs/ShadowNodes.cpp +24 -0
- package/android/src/generated/jni/react/renderer/components/RNMapsSpecs/ShadowNodes.h +109 -0
- package/android/src/generated/jni/react/renderer/components/RNMapsSpecs/States.cpp +16 -0
- package/android/src/generated/jni/react/renderer/components/RNMapsSpecs/States.h +113 -0
- package/android/src/main/java/com/rnmaps/fabric/CalloutManager.java +77 -0
- package/android/src/main/java/com/rnmaps/fabric/CircleManager.java +94 -0
- package/android/src/main/java/com/rnmaps/fabric/JSONUtil.java +86 -0
- package/android/src/main/java/com/rnmaps/fabric/MapViewManager.java +619 -0
- package/android/src/main/java/com/rnmaps/fabric/MarkerManager.java +258 -0
- package/android/src/main/java/com/rnmaps/fabric/NativeAirMapsModule.java +235 -2
- package/android/src/main/java/com/rnmaps/fabric/OverlayManager.java +95 -0
- package/android/src/main/java/com/rnmaps/fabric/PolygonManager.java +89 -0
- package/android/src/main/java/com/rnmaps/fabric/PolylineManager.java +121 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnCalloutPressEvent.java +25 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnDeselectEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnDoublePressEvent.java +27 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnDragEndEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnDragEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnDragStartEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnIndoorBuildingFocusedEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnIndoorLevelActivatedEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnKmlReadyEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnLongPressEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnMapLoadedEvent.java +29 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnMapReadyEvent.java +29 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerDeselectEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerDragEndEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerDragEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerDragStartEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerPressEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerSelectEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnPanDragEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnPoiClickEvent.java +27 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnPressEvent.java +27 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnRegionChangeCompleteEvent.java +30 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnRegionChangeEvent.java +48 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnRegionChangeStartEvent.java +33 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnSelectEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnUserLocationChangeEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/maps/MapAirModulePackage.java +39 -3
- package/android/src/main/java/com/rnmaps/maps/MapCallout.java +18 -0
- package/android/src/main/java/com/rnmaps/maps/MapCircle.java +24 -0
- package/android/src/main/java/com/rnmaps/maps/MapManager.java +14 -14
- package/android/src/main/java/com/rnmaps/maps/MapMarker.java +637 -556
- package/android/src/main/java/com/rnmaps/maps/MapMarkerManager.java +3 -3
- package/android/src/main/java/com/rnmaps/maps/MapModule.java +206 -206
- package/android/src/main/java/com/rnmaps/maps/MapOverlay.java +267 -151
- package/android/src/main/java/com/rnmaps/maps/MapPolygon.java +31 -1
- package/android/src/main/java/com/rnmaps/maps/MapPolyline.java +207 -141
- package/android/src/main/java/com/rnmaps/maps/MapPolylineManager.java +1 -16
- package/android/src/main/java/com/rnmaps/maps/MapView.java +1650 -1337
- package/ios/AirGoogleMaps/AIRGoogleMap.h +9 -10
- package/ios/AirGoogleMaps/AIRGoogleMap.m +109 -71
- package/ios/AirGoogleMaps/AIRGoogleMapCircle.m +23 -11
- package/ios/AirGoogleMaps/AIRGoogleMapManager.m +10 -9
- package/ios/AirGoogleMaps/AIRGoogleMapMarker.m +14 -6
- package/ios/AirGoogleMaps/AIRGoogleMapMarkerManager.m +1 -1
- package/ios/AirGoogleMaps/AIRGoogleMapPolygon.h +2 -1
- package/ios/AirGoogleMaps/AIRGoogleMapPolygon.m +30 -0
- package/ios/AirGoogleMaps/AIRGoogleMapPolyline.h +0 -1
- package/ios/AirGoogleMaps/AIRGoogleMapPolyline.m +0 -7
- package/ios/AirGoogleMaps/AIRGoogleMapUrlTile.m +2 -2
- package/ios/AirGoogleMaps/AIRGoogleMapWMSTile.h +1 -1
- package/ios/AirGoogleMaps/AIRGoogleMapWMSTile.m +4 -4
- package/ios/AirGoogleMaps/RCTConvert+GMSMapViewType.m +2 -0
- package/ios/AirGoogleMaps/RNMapsGoogleMapView.mm +126 -61
- package/ios/AirGoogleMaps/RNMapsGoogleMapViewManager.mm +16 -1
- package/ios/AirGoogleMaps/RNMapsGooglePolygonView.h +26 -0
- package/ios/AirGoogleMaps/RNMapsGooglePolygonView.mm +217 -0
- package/ios/AirGoogleMaps/RNMapsGooglePolygonViewManager.mm +26 -0
- package/ios/AirMaps/AIRMap.h +7 -7
- package/ios/AirMaps/AIRMap.m +227 -236
- package/ios/AirMaps/AIRMapManager.m +13 -7
- package/ios/AirMaps/AIRMapMarker.h +1 -0
- package/ios/AirMaps/AIRMapMarker.m +165 -103
- package/ios/AirMaps/Callout/SMCalloutView.m +1 -1
- package/ios/AirMaps/FabricPlaceholders/PlaceHolderGoogleMapView.h +28 -0
- package/ios/AirMaps/FabricPlaceholders/PlaceHolderGoogleMapView.mm +68 -0
- package/ios/AirMaps/FabricPlaceholders/PlaceHolderPolygonView.h +25 -0
- package/ios/AirMaps/FabricPlaceholders/PlaceHolderPolygonView.mm +43 -0
- package/ios/AirMaps/RNMapsAirModule.h +1 -1
- package/ios/AirMaps/RNMapsAirModule.mm +4 -3
- package/ios/AirMaps/RNMapsAirModuleDelegate.h +2 -2
- package/ios/AirMaps/RNMapsDefines.h +0 -0
- package/ios/AirMaps/RNMapsMapView.mm +336 -299
- package/ios/AirMaps/RNMapsMapViewManager.mm +19 -1
- package/ios/AirMaps/RNMapsMarkerView.h +24 -0
- package/ios/AirMaps/RNMapsMarkerView.mm +430 -0
- package/ios/AirMaps/RNMapsMarkerViewManager.mm +28 -0
- package/ios/AirMaps.xcodeproj/project.pbxproj +20 -0
- package/ios/generated/RCTAppDependencyProvider.h +25 -0
- package/ios/generated/RCTAppDependencyProvider.mm +55 -0
- package/ios/generated/RCTModulesConformingToProtocolsProvider.h +18 -0
- package/ios/generated/RCTModulesConformingToProtocolsProvider.mm +33 -0
- package/ios/generated/RCTThirdPartyComponentsProvider.h +16 -0
- package/ios/generated/RCTThirdPartyComponentsProvider.mm +26 -0
- package/ios/generated/RNMapsSpecs/ComponentDescriptors.cpp +29 -0
- package/ios/generated/RNMapsSpecs/ComponentDescriptors.h +31 -0
- package/ios/generated/RNMapsSpecs/EventEmitters.cpp +977 -0
- package/ios/generated/RNMapsSpecs/EventEmitters.h +846 -0
- package/ios/generated/RNMapsSpecs/Props.cpp +193 -0
- package/ios/generated/RNMapsSpecs/Props.h +1223 -0
- package/ios/generated/RNMapsSpecs/RCTComponentViewHelpers.h +591 -0
- package/ios/generated/RNMapsSpecs/RNMapsSpecs-generated.mm +92 -0
- package/ios/generated/RNMapsSpecs/RNMapsSpecs.h +137 -0
- package/ios/generated/RNMapsSpecs/ShadowNodes.cpp +24 -0
- package/ios/generated/RNMapsSpecs/ShadowNodes.h +109 -0
- package/ios/generated/RNMapsSpecs/States.cpp +16 -0
- package/ios/generated/RNMapsSpecs/States.h +113 -0
- package/ios/generated/RNMapsSpecsJSI-generated.cpp +74 -0
- package/ios/generated/RNMapsSpecsJSI.h +268 -0
- package/ios/generated/ReactAppDependencyProvider.podspec +34 -0
- package/package.json +24 -18
- package/react-native-google-maps.podspec +26 -0
- package/react-native-maps-generated.podspec +31 -0
- package/react-native-maps.podspec +44 -15
- package/src/AnimatedRegion.ts +169 -0
- package/src/Geojson.tsx +541 -0
- package/src/MapCallout.tsx +77 -0
- package/src/MapCalloutSubview.tsx +64 -0
- package/src/MapCircle.tsx +162 -0
- package/src/MapHeatmap.tsx +125 -0
- package/src/MapLocalTile.tsx +60 -0
- package/src/MapMarker.tsx +531 -0
- package/src/MapMarkerNativeComponent.ts +51 -0
- package/src/MapOverlay.tsx +156 -0
- package/src/MapPolygon.tsx +188 -0
- package/src/MapPolygon.types.ts +25 -0
- package/src/MapPolyline.tsx +215 -0
- package/src/MapUrlTile.tsx +169 -0
- package/src/MapView.tsx +1223 -0
- package/src/MapView.types.ts +212 -0
- package/src/MapView.web.ts +2 -0
- package/src/MapViewNativeComponent.ts +86 -0
- package/src/MapWMSTile.tsx +148 -0
- package/src/ProviderConstants.ts +2 -0
- package/src/createFabricMap.tsx +253 -0
- package/src/decorateMapComponent.ts +219 -0
- package/src/fixImageProp.ts +17 -0
- package/src/index.ts +52 -0
- package/src/sharedTypes.ts +101 -0
- package/src/specs/NativeAirMapsModule.ts +36 -0
- package/src/specs/NativeComponentCallout.ts +63 -0
- package/src/specs/NativeComponentCircle.ts +93 -0
- package/src/specs/NativeComponentGoogleMapView.ts +913 -0
- package/src/specs/NativeComponentGooglePolygon.ts +94 -0
- package/src/specs/NativeComponentMapView.ts +1091 -0
- package/src/specs/NativeComponentMarker.ts +326 -0
- package/src/specs/NativeComponentOverlay.ts +89 -0
- package/src/specs/NativeComponentPolyline.ts +124 -0
- package/lib/AnimatedRegion.d.ts +0 -19
- package/lib/AnimatedRegion.js +0 -134
- package/lib/Geojson.d.ts +0 -204
- package/lib/Geojson.js +0 -166
- package/lib/MapCallout.d.ts +0 -40
- package/lib/MapCallout.js +0 -51
- package/lib/MapCalloutSubview.d.ts +0 -34
- package/lib/MapCalloutSubview.js +0 -48
- package/lib/MapCircle.d.ts +0 -117
- package/lib/MapCircle.js +0 -53
- package/lib/MapHeatmap.d.ts +0 -78
- package/lib/MapHeatmap.js +0 -59
- package/lib/MapLocalTile.d.ts +0 -35
- package/lib/MapLocalTile.js +0 -44
- package/lib/MapMarker.d.ts +0 -309
- package/lib/MapMarker.js +0 -116
- package/lib/MapMarkerNativeComponent.d.ts +0 -15
- package/lib/MapMarkerNativeComponent.js +0 -17
- package/lib/MapOverlay.d.ts +0 -87
- package/lib/MapOverlay.js +0 -63
- package/lib/MapPolygon.d.ts +0 -140
- package/lib/MapPolygon.js +0 -53
- package/lib/MapPolygon.types.d.ts +0 -18
- package/lib/MapPolygon.types.js +0 -2
- package/lib/MapPolyline.d.ts +0 -156
- package/lib/MapPolyline.js +0 -53
- package/lib/MapUrlTile.d.ts +0 -134
- package/lib/MapUrlTile.js +0 -44
- package/lib/MapView.d.ts +0 -715
- package/lib/MapView.js +0 -447
- package/lib/MapView.types.d.ts +0 -161
- package/lib/MapView.types.js +0 -2
- package/lib/MapView.web.d.ts +0 -1
- package/lib/MapView.web.js +0 -9
- package/lib/MapViewNativeComponent.d.ts +0 -18
- package/lib/MapViewNativeComponent.js +0 -19
- package/lib/MapWMSTile.d.ts +0 -116
- package/lib/MapWMSTile.js +0 -44
- package/lib/ProviderConstants.d.ts +0 -2
- package/lib/ProviderConstants.js +0 -5
- package/lib/createFabricMap.d.ts +0 -23
- package/lib/createFabricMap.js +0 -175
- package/lib/decorateMapComponent.d.ts +0 -36
- package/lib/decorateMapComponent.js +0 -80
- package/lib/index.d.ts +0 -38
- package/lib/index.js +0 -81
- package/lib/sharedTypes.d.ts +0 -81
- package/lib/sharedTypes.js +0 -2
- package/lib/sharedTypesInternal.js +0 -2
- package/lib/specs/NativeAirMapsModule.d.ts +0 -31
- package/lib/specs/NativeAirMapsModule.js +0 -4
- package/lib/specs/NativeComponentGoogleMapView.d.ts +0 -713
- package/lib/specs/NativeComponentGoogleMapView.js +0 -21
- package/lib/specs/NativeComponentMapView.d.ts +0 -855
- package/lib/specs/NativeComponentMapView.js +0 -21
- /package/{lib/sharedTypesInternal.d.ts → src/sharedTypesInternal.ts} +0 -0
|
@@ -7,13 +7,14 @@
|
|
|
7
7
|
//
|
|
8
8
|
|
|
9
9
|
#import "RNMapsMapView.h"
|
|
10
|
-
#import "
|
|
10
|
+
#import "AIRMap.h"
|
|
11
11
|
#import "AIRMapMarker.h"
|
|
12
12
|
#import "AIRMapManager.h"
|
|
13
|
-
#import
|
|
14
|
-
#import <react/
|
|
15
|
-
#import <react/
|
|
16
|
-
#import <react/
|
|
13
|
+
#import "RNMapsMarkerView.h"
|
|
14
|
+
#import <react-native-maps-generated/EventEmitters.h>
|
|
15
|
+
#import <react-native-maps-generated/ComponentDescriptors.h>
|
|
16
|
+
#import <react-native-maps-generated/Props.h>
|
|
17
|
+
#import <react-native-maps-generated/RCTComponentViewHelpers.h>
|
|
17
18
|
#import "RCTFabricComponentsPlugins.h"
|
|
18
19
|
#import <React/RCTConversions.h>
|
|
19
20
|
#import "UIView+AirMap.h"
|
|
@@ -33,12 +34,22 @@ using namespace facebook::react;
|
|
|
33
34
|
return _view;
|
|
34
35
|
}
|
|
35
36
|
|
|
37
|
+
- (void) prepareForRecycle
|
|
38
|
+
{
|
|
39
|
+
[super prepareForRecycle];
|
|
40
|
+
[_view removeFromSuperview];
|
|
41
|
+
_view = nil;
|
|
42
|
+
_legacyMapManager = nil;
|
|
43
|
+
self.contentView = nil;
|
|
44
|
+
}
|
|
45
|
+
|
|
36
46
|
#pragma mark - JS Commands
|
|
37
47
|
- (void)animateToRegion:(NSString *)regionJSON duration:(NSInteger)duration{
|
|
38
48
|
NSDictionary* regionDic = [RCTConvert dictonaryFromString:regionJSON];
|
|
39
|
-
[
|
|
40
|
-
|
|
41
|
-
|
|
49
|
+
MKCoordinateRegion region = [RCTConvert MKCoordinateRegion:regionDic];
|
|
50
|
+
Boolean animated = duration == 0 ? NO :YES;
|
|
51
|
+
_view.ignoreRegionChanges = animated;
|
|
52
|
+
[_view setRegion:region animated:animated];
|
|
42
53
|
}
|
|
43
54
|
- (void)setCamera:(NSString *)cameraJSON{
|
|
44
55
|
NSDictionary* cameraDic = [RCTConvert dictonaryFromString:cameraJSON];
|
|
@@ -49,16 +60,9 @@ using namespace facebook::react;
|
|
|
49
60
|
- (void)animateCamera:(NSString *)cameraJSON duration:(NSInteger)duration{
|
|
50
61
|
NSDictionary* cameraDic = [RCTConvert dictonaryFromString:cameraJSON];
|
|
51
62
|
MKMapCamera *camera = [RCTConvert MKMapCameraWithDefaults:cameraDic existingCamera:[_view camera]];
|
|
52
|
-
|
|
53
63
|
// don't emit region change events when we are setting the camera
|
|
54
|
-
BOOL originalIgnore = _view.ignoreRegionChanges;
|
|
55
64
|
_view.ignoreRegionChanges = YES;
|
|
56
|
-
[
|
|
57
|
-
[self->_view setCamera:camera animated:YES];
|
|
58
|
-
} completion:^(BOOL finished){
|
|
59
|
-
self->_view.ignoreRegionChanges = originalIgnore;
|
|
60
|
-
}];
|
|
61
|
-
|
|
65
|
+
[_view setCamera:camera animated:YES];
|
|
62
66
|
}
|
|
63
67
|
|
|
64
68
|
- (void)fitToElements:(NSString *)edgePaddingJSON animated:(BOOL)animated {
|
|
@@ -73,7 +77,6 @@ using namespace facebook::react;
|
|
|
73
77
|
}];
|
|
74
78
|
NSArray *filteredMarkers = [_view.annotations filteredArrayUsingPredicate:filterMarkers];
|
|
75
79
|
[_view showAnnotations:filteredMarkers animated:animated];
|
|
76
|
-
|
|
77
80
|
}
|
|
78
81
|
- (void)fitToCoordinates:(NSString *)coordinatesJSON edgePaddingJSON:(NSString *)edgePaddingJSON animated:(BOOL)animated {
|
|
79
82
|
NSArray* coordinatesArr = [RCTConvert arrayFromString:coordinatesJSON];
|
|
@@ -89,6 +92,11 @@ using namespace facebook::react;
|
|
|
89
92
|
|
|
90
93
|
}
|
|
91
94
|
|
|
95
|
+
- (void) setIndoorActiveLevelIndex:(NSInteger) activeLevelIndex
|
|
96
|
+
{
|
|
97
|
+
// do nothing (google only)
|
|
98
|
+
}
|
|
99
|
+
|
|
92
100
|
#pragma mark - Native commands
|
|
93
101
|
|
|
94
102
|
- (void)handleCommand:(const NSString *)commandName args:(const NSArray *)args
|
|
@@ -99,264 +107,269 @@ using namespace facebook::react;
|
|
|
99
107
|
|
|
100
108
|
+ (ComponentDescriptorProvider)componentDescriptorProvider
|
|
101
109
|
{
|
|
102
|
-
|
|
110
|
+
return concreteComponentDescriptorProvider<RNMapsMapViewComponentDescriptor>();
|
|
103
111
|
}
|
|
104
112
|
|
|
105
|
-
|
|
106
|
-
- (instancetype)initWithFrame:(CGRect)frame
|
|
113
|
+
- (void) prepareMapView
|
|
107
114
|
{
|
|
108
|
-
|
|
115
|
+
if (_legacyMapManager && _view) return;
|
|
109
116
|
static const auto defaultProps = std::make_shared<const RNMapsMapViewProps>();
|
|
110
117
|
_props = defaultProps;
|
|
111
|
-
|
|
118
|
+
_legacyMapManager = [[AIRMapManager alloc] init];
|
|
112
119
|
_view = (AIRMap *)[_legacyMapManager view];
|
|
113
120
|
|
|
114
121
|
self.contentView = _view;
|
|
115
122
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
_view.onMapReady = [self](NSDictionary* dictionary) {
|
|
146
|
-
if (_eventEmitter) {
|
|
147
|
-
|
|
148
|
-
auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
|
|
149
|
-
facebook::react::RNMapsMapViewEventEmitter::OnMapReady data = {};
|
|
150
|
-
mapViewEventEmitter->onMapReady(data);
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
_view.onChange = [self](NSDictionary* dictionary) {
|
|
154
|
-
if (_eventEmitter) {
|
|
155
|
-
|
|
156
|
-
NSDictionary* regionDict = dictionary[@"region"];
|
|
157
|
-
auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
|
|
158
|
-
facebook::react::RNMapsMapViewEventEmitter::OnRegionChange data = {
|
|
159
|
-
.region.latitude = [regionDict[@"latitude"] doubleValue],
|
|
160
|
-
.region.longitude = [regionDict[@"longitude"] doubleValue],
|
|
161
|
-
.region.latitudeDelta = [regionDict[@"latitudeDelta"] doubleValue],
|
|
162
|
-
.region.longitudeDelta = [regionDict[@"longitudeDelta"] doubleValue],
|
|
163
|
-
.continuous = [dictionary[@"continuous"] boolValue],
|
|
164
|
-
};
|
|
165
|
-
mapViewEventEmitter->onRegionChange(data);
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
|
-
_view.onDoublePress = [self](NSDictionary* dictionary) {
|
|
169
|
-
if (_eventEmitter) {
|
|
170
|
-
|
|
171
|
-
NSDictionary* coordinateDict = dictionary[@"coordinate"];
|
|
172
|
-
NSDictionary* positionDict = dictionary[@"position"];
|
|
173
|
-
|
|
174
|
-
// Populate the OnMapPressCoordinate struct
|
|
175
|
-
facebook::react::RNMapsMapViewEventEmitter::OnDoublePressCoordinate coordinate = {
|
|
176
|
-
.latitude = [coordinateDict[@"latitude"] doubleValue],
|
|
177
|
-
.longitude = [coordinateDict[@"longitude"] doubleValue],
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
// Populate the OnMapDouplePressPosition struct
|
|
181
|
-
facebook::react::RNMapsMapViewEventEmitter::OnDoublePressPosition position = {
|
|
182
|
-
.x = [positionDict[@"x"] doubleValue],
|
|
183
|
-
.y = [positionDict[@"y"] doubleValue],
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
|
|
188
|
-
facebook::react::RNMapsMapViewEventEmitter::OnDoublePress data = {
|
|
189
|
-
.position = position,
|
|
190
|
-
.coordinate = coordinate
|
|
191
|
-
};
|
|
192
|
-
mapViewEventEmitter->onDoublePress(data);
|
|
193
|
-
}
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
_view.onPanDrag = [self](NSDictionary* dictionary) {
|
|
197
|
-
if (_eventEmitter) {
|
|
198
|
-
|
|
199
|
-
NSDictionary* coordinateDict = dictionary[@"coordinate"];
|
|
200
|
-
NSDictionary* positionDict = dictionary[@"position"];
|
|
201
|
-
|
|
202
|
-
// Populate the OnMapPressCoordinate struct
|
|
203
|
-
facebook::react::RNMapsMapViewEventEmitter::OnPanDragCoordinate coordinate = {
|
|
204
|
-
.latitude = [coordinateDict[@"latitude"] doubleValue],
|
|
205
|
-
.longitude = [coordinateDict[@"longitude"] doubleValue],
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
// Populate the OnMapDouplePressPosition struct
|
|
209
|
-
facebook::react::RNMapsMapViewEventEmitter::OnPanDragPosition position = {
|
|
210
|
-
.x = [positionDict[@"x"] doubleValue],
|
|
211
|
-
.y = [positionDict[@"y"] doubleValue],
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
|
|
215
|
-
facebook::react::RNMapsMapViewEventEmitter::OnPanDrag data = {
|
|
216
|
-
.position = position,
|
|
217
|
-
.coordinate = coordinate,
|
|
218
|
-
};
|
|
219
|
-
mapViewEventEmitter->onPanDrag(data);
|
|
220
|
-
}
|
|
221
|
-
};
|
|
222
|
-
|
|
223
|
-
_view.onUserLocationChange = [self](NSDictionary* dictionary) {
|
|
224
|
-
if (_eventEmitter) {
|
|
225
|
-
|
|
226
|
-
NSDictionary* coordinateDict = dictionary[@"coordinate"];
|
|
227
|
-
NSDictionary* errorDict = dictionary[@"error"];
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
// Populate the OnMapPressCoordinate struct
|
|
231
|
-
facebook::react::RNMapsMapViewEventEmitter::OnUserLocationChangeCoordinate coordinate = {
|
|
232
|
-
.latitude = [coordinateDict[@"latitude"] doubleValue],
|
|
233
|
-
.longitude = [coordinateDict[@"longitude"] doubleValue],
|
|
234
|
-
};
|
|
235
|
-
facebook::react::RNMapsMapViewEventEmitter::OnUserLocationChangeError error = {
|
|
236
|
-
.message = std::string([errorDict[@"message"] UTF8String]),
|
|
237
|
-
};
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
|
|
241
|
-
facebook::react::RNMapsMapViewEventEmitter::OnUserLocationChange data = {
|
|
242
|
-
.coordinate = coordinate,
|
|
243
|
-
.error = error,
|
|
244
|
-
};
|
|
245
|
-
mapViewEventEmitter->onUserLocationChange(data);
|
|
246
|
-
}
|
|
247
|
-
};
|
|
248
|
-
|
|
249
|
-
_view.onCalloutPress = [self](NSDictionary* dictionary) {
|
|
250
|
-
if (_eventEmitter) {
|
|
251
|
-
|
|
252
|
-
NSDictionary* coordinateDict = dictionary[@"coordinate"];
|
|
253
|
-
NSDictionary* positionDict = dictionary[@"position"];
|
|
254
|
-
|
|
255
|
-
// Populate the OnCalloutPressPoint struct
|
|
256
|
-
facebook::react::RNMapsMapViewEventEmitter::OnCalloutPressPoint point = {
|
|
257
|
-
.x = [coordinateDict[@"x"] doubleValue],
|
|
258
|
-
.y = [coordinateDict[@"y"] doubleValue],
|
|
259
|
-
};
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
facebook::react::RNMapsMapViewEventEmitter::OnCalloutPressFrame frame = {
|
|
263
|
-
.x = [positionDict[@"x"] doubleValue],
|
|
264
|
-
.y = [positionDict[@"y"] doubleValue],
|
|
265
|
-
.width = [positionDict[@"width"] doubleValue],
|
|
266
|
-
.height = [positionDict[@"height"] doubleValue],
|
|
267
|
-
};
|
|
268
|
-
|
|
269
|
-
auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
|
|
270
|
-
facebook::react::RNMapsMapViewEventEmitter::OnCalloutPress data = {
|
|
271
|
-
.action = std::string([dictionary[@"action"] UTF8String]),
|
|
272
|
-
.id = std::string([dictionary[@"id"] UTF8String]),
|
|
273
|
-
.point = point,
|
|
274
|
-
.frame = frame,
|
|
275
|
-
};
|
|
276
|
-
mapViewEventEmitter->onCalloutPress(data);
|
|
277
|
-
}
|
|
278
|
-
};
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
_view.onRegionChangeStart = [self](NSDictionary* dictionary) {
|
|
282
|
-
if (_eventEmitter) {
|
|
283
|
-
|
|
284
|
-
NSDictionary* regionDict = dictionary[@"region"];
|
|
285
|
-
auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
|
|
286
|
-
facebook::react::RNMapsMapViewEventEmitter::OnRegionChangeStart data = {
|
|
287
|
-
.region.latitude = [regionDict[@"latitude"] doubleValue],
|
|
288
|
-
.region.longitude = [regionDict[@"longitude"] doubleValue],
|
|
289
|
-
.region.latitudeDelta = [regionDict[@"latitudeDelta"] doubleValue],
|
|
290
|
-
.region.longitudeDelta = [regionDict[@"longitudeDelta"] doubleValue],
|
|
291
|
-
.continuous = [dictionary[@"continuous"] boolValue],
|
|
292
|
-
};
|
|
293
|
-
mapViewEventEmitter->onRegionChangeStart(data);
|
|
294
|
-
}
|
|
295
|
-
};
|
|
123
|
+
_view.onPress = [self](NSDictionary* dictionary) {
|
|
124
|
+
if (_eventEmitter) {
|
|
125
|
+
// Extract values from the NSDictionary
|
|
126
|
+
NSDictionary* coordinateDict = dictionary[@"coordinate"];
|
|
127
|
+
NSDictionary* positionDict = dictionary[@"position"];
|
|
128
|
+
|
|
129
|
+
// Populate the OnMapPressCoordinate struct
|
|
130
|
+
facebook::react::RNMapsMapViewEventEmitter::OnPressCoordinate coordinate = {
|
|
131
|
+
.latitude = [coordinateDict[@"latitude"] doubleValue],
|
|
132
|
+
.longitude = [coordinateDict[@"longitude"] doubleValue],
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
// Populate the OnMapPressPosition struct
|
|
136
|
+
facebook::react::RNMapsMapViewEventEmitter::OnPressPosition position = {
|
|
137
|
+
.x = [positionDict[@"x"] doubleValue],
|
|
138
|
+
.y = [positionDict[@"y"] doubleValue],
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
|
|
142
|
+
facebook::react::RNMapsMapViewEventEmitter::OnPress data = {
|
|
143
|
+
.action = std::string([@"press" UTF8String]),
|
|
144
|
+
.position = position,
|
|
145
|
+
.coordinate = coordinate
|
|
146
|
+
};
|
|
147
|
+
mapViewEventEmitter->onPress(data);
|
|
148
|
+
}
|
|
149
|
+
};
|
|
296
150
|
|
|
297
151
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
NSDictionary* coordinateDict = dictionary[@"coordinate"]; \
|
|
301
|
-
auto mapViewEventEmitter = \
|
|
302
|
-
std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter); \
|
|
303
|
-
facebook::react::RNMapsMapViewEventEmitter::eventName data = { \
|
|
304
|
-
.coordinate.latitude = [coordinateDict[@"latitude"] doubleValue], \
|
|
305
|
-
.coordinate.longitude = [coordinateDict[@"longitude"] doubleValue], \
|
|
306
|
-
.id = std::string([[dictionary valueForKey:@"id"] UTF8String]), \
|
|
307
|
-
}; \
|
|
308
|
-
mapViewEventEmitter->emitterFunction(data); \
|
|
309
|
-
}
|
|
152
|
+
_view.onMapReady = [self](NSDictionary* dictionary) {
|
|
153
|
+
if (_eventEmitter) {
|
|
310
154
|
|
|
155
|
+
auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
|
|
156
|
+
facebook::react::RNMapsMapViewEventEmitter::OnMapReady data = {};
|
|
157
|
+
mapViewEventEmitter->onMapReady(data);
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
_view.onRegionChange = [self](NSDictionary* dictionary) {
|
|
161
|
+
if (_eventEmitter) {
|
|
162
|
+
NSDictionary* regionDict = dictionary[@"region"];
|
|
163
|
+
auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
|
|
164
|
+
facebook::react::RNMapsMapViewEventEmitter::OnRegionChange data = {
|
|
165
|
+
.region.latitude = [regionDict[@"latitude"] doubleValue],
|
|
166
|
+
.region.longitude = [regionDict[@"longitude"] doubleValue],
|
|
167
|
+
.region.latitudeDelta = [regionDict[@"latitudeDelta"] doubleValue],
|
|
168
|
+
.region.longitudeDelta = [regionDict[@"longitudeDelta"] doubleValue],
|
|
169
|
+
.continuous = [dictionary[@"continuous"] boolValue],
|
|
170
|
+
};
|
|
171
|
+
mapViewEventEmitter->onRegionChange(data);
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
_view.onDoublePress = [self](NSDictionary* dictionary) {
|
|
175
|
+
if (_eventEmitter) {
|
|
176
|
+
|
|
177
|
+
NSDictionary* coordinateDict = dictionary[@"coordinate"];
|
|
178
|
+
NSDictionary* positionDict = dictionary[@"position"];
|
|
179
|
+
|
|
180
|
+
// Populate the OnMapPressCoordinate struct
|
|
181
|
+
facebook::react::RNMapsMapViewEventEmitter::OnDoublePressCoordinate coordinate = {
|
|
182
|
+
.latitude = [coordinateDict[@"latitude"] doubleValue],
|
|
183
|
+
.longitude = [coordinateDict[@"longitude"] doubleValue],
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
// Populate the OnMapDouplePressPosition struct
|
|
187
|
+
facebook::react::RNMapsMapViewEventEmitter::OnDoublePressPosition position = {
|
|
188
|
+
.x = [positionDict[@"x"] doubleValue],
|
|
189
|
+
.y = [positionDict[@"y"] doubleValue],
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
|
|
194
|
+
facebook::react::RNMapsMapViewEventEmitter::OnDoublePress data = {
|
|
195
|
+
.position = position,
|
|
196
|
+
.coordinate = coordinate
|
|
197
|
+
};
|
|
198
|
+
mapViewEventEmitter->onDoublePress(data);
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
_view.onPanDrag = [self](NSDictionary* dictionary) {
|
|
203
|
+
if (_eventEmitter) {
|
|
204
|
+
|
|
205
|
+
NSDictionary* coordinateDict = dictionary[@"coordinate"];
|
|
206
|
+
NSDictionary* positionDict = dictionary[@"position"];
|
|
207
|
+
|
|
208
|
+
// Populate the OnMapPressCoordinate struct
|
|
209
|
+
facebook::react::RNMapsMapViewEventEmitter::OnPanDragCoordinate coordinate = {
|
|
210
|
+
.latitude = [coordinateDict[@"latitude"] doubleValue],
|
|
211
|
+
.longitude = [coordinateDict[@"longitude"] doubleValue],
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
// Populate the OnMapDouplePressPosition struct
|
|
215
|
+
facebook::react::RNMapsMapViewEventEmitter::OnPanDragPosition position = {
|
|
216
|
+
.x = [positionDict[@"x"] doubleValue],
|
|
217
|
+
.y = [positionDict[@"y"] doubleValue],
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
|
|
221
|
+
facebook::react::RNMapsMapViewEventEmitter::OnPanDrag data = {
|
|
222
|
+
.position = position,
|
|
223
|
+
.coordinate = coordinate,
|
|
224
|
+
};
|
|
225
|
+
mapViewEventEmitter->onPanDrag(data);
|
|
226
|
+
}
|
|
227
|
+
};
|
|
311
228
|
|
|
229
|
+
_view.onUserLocationChange = [self](NSDictionary* dictionary) {
|
|
230
|
+
if (_eventEmitter) {
|
|
312
231
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
NSDictionary* coordinateDict = dictionary[@"coordinate"]; \
|
|
316
|
-
facebook::react::RNMapsMapViewEventEmitter::eventName##Coordinate coordinate = { \
|
|
317
|
-
.latitude = [coordinateDict[@"latitude"] doubleValue], \
|
|
318
|
-
.longitude = [coordinateDict[@"longitude"] doubleValue], \
|
|
319
|
-
}; \
|
|
320
|
-
\
|
|
321
|
-
auto mapViewEventEmitter = \
|
|
322
|
-
std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter); \
|
|
323
|
-
facebook::react::RNMapsMapViewEventEmitter::eventName data = { \
|
|
324
|
-
.action = std::string([@actionName UTF8String]), \
|
|
325
|
-
.id = std::string([[dictionary valueForKey:@"id"] UTF8String]), \
|
|
326
|
-
.coordinate = coordinate \
|
|
327
|
-
}; \
|
|
328
|
-
mapViewEventEmitter->emitterFunction(data); \
|
|
329
|
-
}
|
|
232
|
+
NSDictionary* coordinateDict = dictionary[@"coordinate"];
|
|
233
|
+
NSDictionary* errorDict = dictionary[@"error"];
|
|
330
234
|
|
|
331
|
-
_view.onMarkerDrag = [self](NSDictionary* dictionary) {
|
|
332
|
-
HANDLE_MARKER_DRAG_EVENT(OnMarkerDrag, onMarkerDrag);
|
|
333
|
-
};
|
|
334
235
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
236
|
+
// Populate the OnMapPressCoordinate struct
|
|
237
|
+
facebook::react::RNMapsMapViewEventEmitter::OnUserLocationChangeCoordinate coordinate = {
|
|
238
|
+
.latitude = [coordinateDict[@"latitude"] doubleValue],
|
|
239
|
+
.longitude = [coordinateDict[@"longitude"] doubleValue],
|
|
240
|
+
};
|
|
241
|
+
NSString* str = @"";
|
|
242
|
+
if (errorDict){
|
|
243
|
+
str = errorDict[@"message"];
|
|
244
|
+
}
|
|
338
245
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
246
|
+
facebook::react::RNMapsMapViewEventEmitter::OnUserLocationChangeError error = {
|
|
247
|
+
.message = std::string([str UTF8String]),
|
|
248
|
+
};
|
|
342
249
|
|
|
343
|
-
_view.onMarkerSelect = [self](NSDictionary* dictionary) {
|
|
344
|
-
HANDLE_MARKER_EVENT(OnMarkerSelect, onMarkerSelect, "marker-select");
|
|
345
|
-
};
|
|
346
250
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
251
|
+
auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
|
|
252
|
+
facebook::react::RNMapsMapViewEventEmitter::OnUserLocationChange data = {
|
|
253
|
+
.coordinate = coordinate,
|
|
254
|
+
.error = error,
|
|
255
|
+
};
|
|
256
|
+
mapViewEventEmitter->onUserLocationChange(data);
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
_view.onCalloutPress = [self](NSDictionary* dictionary) {
|
|
261
|
+
if (_eventEmitter) {
|
|
262
|
+
|
|
263
|
+
NSDictionary* coordinateDict = dictionary[@"coordinate"];
|
|
264
|
+
NSDictionary* positionDict = dictionary[@"position"];
|
|
265
|
+
|
|
266
|
+
// Populate the OnCalloutPressPoint struct
|
|
267
|
+
facebook::react::RNMapsMapViewEventEmitter::OnCalloutPressPoint point = {
|
|
268
|
+
.x = [coordinateDict[@"x"] doubleValue],
|
|
269
|
+
.y = [coordinateDict[@"y"] doubleValue],
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
facebook::react::RNMapsMapViewEventEmitter::OnCalloutPressFrame frame = {
|
|
274
|
+
.x = [positionDict[@"x"] doubleValue],
|
|
275
|
+
.y = [positionDict[@"y"] doubleValue],
|
|
276
|
+
.width = [positionDict[@"width"] doubleValue],
|
|
277
|
+
.height = [positionDict[@"height"] doubleValue],
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
|
|
281
|
+
facebook::react::RNMapsMapViewEventEmitter::OnCalloutPress data = {
|
|
282
|
+
.action = std::string([dictionary[@"action"] UTF8String]),
|
|
283
|
+
.id = std::string([dictionary[@"id"] UTF8String]),
|
|
284
|
+
.point = point,
|
|
285
|
+
.frame = frame,
|
|
286
|
+
};
|
|
287
|
+
mapViewEventEmitter->onCalloutPress(data);
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
_view.onRegionChangeStart = [self](NSDictionary* dictionary) {
|
|
293
|
+
if (_eventEmitter) {
|
|
294
|
+
|
|
295
|
+
NSDictionary* regionDict = dictionary[@"region"];
|
|
296
|
+
auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
|
|
297
|
+
facebook::react::RNMapsMapViewEventEmitter::OnRegionChangeStart data = {
|
|
298
|
+
.region.latitude = [regionDict[@"latitude"] doubleValue],
|
|
299
|
+
.region.longitude = [regionDict[@"longitude"] doubleValue],
|
|
300
|
+
.region.latitudeDelta = [regionDict[@"latitudeDelta"] doubleValue],
|
|
301
|
+
.region.longitudeDelta = [regionDict[@"longitudeDelta"] doubleValue],
|
|
302
|
+
.continuous = [dictionary[@"continuous"] boolValue],
|
|
303
|
+
};
|
|
304
|
+
mapViewEventEmitter->onRegionChangeStart(data);
|
|
305
|
+
}
|
|
306
|
+
};
|
|
350
307
|
|
|
351
|
-
_view.onMarkerPress = [self](NSDictionary* dictionary) {
|
|
352
|
-
HANDLE_MARKER_EVENT(OnMarkerPress, onMarkerPress, "marker-press");
|
|
353
|
-
};
|
|
354
308
|
|
|
309
|
+
#define HANDLE_MARKER_DRAG_EVENT(eventName, emitterFunction) \
|
|
310
|
+
if (_eventEmitter) { \
|
|
311
|
+
NSDictionary* coordinateDict = dictionary[@"coordinate"]; \
|
|
312
|
+
auto mapViewEventEmitter = \
|
|
313
|
+
std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter); \
|
|
314
|
+
facebook::react::RNMapsMapViewEventEmitter::eventName data = { \
|
|
315
|
+
.coordinate.latitude = [coordinateDict[@"latitude"] doubleValue], \
|
|
316
|
+
.coordinate.longitude = [coordinateDict[@"longitude"] doubleValue], \
|
|
317
|
+
.id = std::string([[dictionary valueForKey:@"id"] UTF8String]), \
|
|
318
|
+
}; \
|
|
319
|
+
mapViewEventEmitter->emitterFunction(data); \
|
|
320
|
+
}
|
|
355
321
|
|
|
356
322
|
|
|
357
|
-
}
|
|
358
323
|
|
|
359
|
-
|
|
324
|
+
#define HANDLE_MARKER_EVENT(eventName, emitterFunction, actionName) \
|
|
325
|
+
if (_eventEmitter) { \
|
|
326
|
+
NSDictionary* coordinateDict = dictionary[@"coordinate"]; \
|
|
327
|
+
facebook::react::RNMapsMapViewEventEmitter::eventName##Coordinate coordinate = { \
|
|
328
|
+
.latitude = [coordinateDict[@"latitude"] doubleValue], \
|
|
329
|
+
.longitude = [coordinateDict[@"longitude"] doubleValue], \
|
|
330
|
+
}; \
|
|
331
|
+
\
|
|
332
|
+
auto mapViewEventEmitter = \
|
|
333
|
+
std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter); \
|
|
334
|
+
facebook::react::RNMapsMapViewEventEmitter::eventName data = { \
|
|
335
|
+
.action = std::string([@actionName UTF8String]), \
|
|
336
|
+
.id = std::string([[dictionary valueForKey:@"id"] UTF8String]), \
|
|
337
|
+
.coordinate = coordinate \
|
|
338
|
+
}; \
|
|
339
|
+
mapViewEventEmitter->emitterFunction(data); \
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
_view.onMarkerDrag = [self](NSDictionary* dictionary) {
|
|
343
|
+
HANDLE_MARKER_DRAG_EVENT(OnMarkerDrag, onMarkerDrag);
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
_view.onMarkerDragStart = [self](NSDictionary* dictionary) {
|
|
347
|
+
HANDLE_MARKER_DRAG_EVENT(OnMarkerDragStart, onMarkerDragStart);
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
_view.onMarkerDragEnd = [self](NSDictionary* dictionary) {
|
|
351
|
+
HANDLE_MARKER_DRAG_EVENT(OnMarkerDragEnd, onMarkerDragEnd);
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
_view.onMarkerSelect = [self](NSDictionary* dictionary) {
|
|
355
|
+
HANDLE_MARKER_EVENT(OnMarkerSelect, onMarkerSelect, "marker-select");
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
_view.onMarkerDeselect = [self](NSDictionary* dictionary) {
|
|
359
|
+
HANDLE_MARKER_EVENT(OnMarkerDeselect, onMarkerDeselect, "marker-deselect");
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
_view.onMarkerPress = [self](NSDictionary* dictionary) {
|
|
363
|
+
HANDLE_MARKER_EVENT(OnMarkerPress, onMarkerPress, "marker-press");
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
- (instancetype)initWithFrame:(CGRect)frame
|
|
367
|
+
{
|
|
368
|
+
if (self = [super initWithFrame:frame]) {
|
|
369
|
+
[self prepareMapView];
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
return self;
|
|
360
373
|
}
|
|
361
374
|
|
|
362
375
|
|
|
@@ -364,16 +377,25 @@ using namespace facebook::react;
|
|
|
364
377
|
id<RCTComponent> paperView = [childComponentView getPaperViewFromChildComponentView];
|
|
365
378
|
if (paperView){
|
|
366
379
|
[_view insertReactSubview:paperView atIndex:index];
|
|
367
|
-
} else {
|
|
380
|
+
} else if ([childComponentView isKindOfClass:[RNMapsMarkerView class]]){
|
|
381
|
+
RNMapsMarkerView* fabricMarker = (RNMapsMarkerView *) childComponentView;
|
|
382
|
+
[_view insertReactSubview:[fabricMarker marker] atIndex:index];
|
|
383
|
+
}
|
|
384
|
+
else {
|
|
368
385
|
[_view insertReactSubview:childComponentView atIndex:index];
|
|
369
386
|
}
|
|
370
387
|
}
|
|
388
|
+
|
|
371
389
|
- (void) unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
|
|
372
390
|
{
|
|
373
391
|
id<RCTComponent> paperView = [childComponentView getPaperViewFromChildComponentView];
|
|
374
392
|
if (paperView){
|
|
375
393
|
[_view removeReactSubview:paperView];
|
|
376
|
-
}
|
|
394
|
+
}
|
|
395
|
+
else if ([childComponentView isKindOfClass:[RNMapsMarkerView class]]){
|
|
396
|
+
RNMapsMarkerView* fabricMarker = (RNMapsMarkerView *) childComponentView;
|
|
397
|
+
[_view removeReactSubview:[fabricMarker marker]];
|
|
398
|
+
} else {
|
|
377
399
|
[_view removeReactSubview:childComponentView];
|
|
378
400
|
}
|
|
379
401
|
}
|
|
@@ -393,67 +415,76 @@ MKMapType mapRNTypeToMKMapType(RNMapsMapViewMapType rnMapType) {
|
|
|
393
415
|
|
|
394
416
|
- (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
|
|
395
417
|
{
|
|
396
|
-
|
|
397
|
-
|
|
418
|
+
[self prepareMapView];
|
|
419
|
+
const auto &oldViewProps = *std::static_pointer_cast<RNMapsMapViewProps const>(_props);
|
|
420
|
+
const auto &newViewProps = *std::static_pointer_cast<RNMapsMapViewProps const>(props);
|
|
398
421
|
|
|
399
422
|
#define REMAP_MAPVIEW_PROP(name) \
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
423
|
+
if (oldViewProps.name != newViewProps.name) { \
|
|
424
|
+
_view.name = newViewProps.name; \
|
|
425
|
+
}
|
|
403
426
|
|
|
404
427
|
#define REMAP_MAPVIEW_STRING_PROP(name) \
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
428
|
+
if (oldViewProps.name != newViewProps.name) { \
|
|
429
|
+
_view.name = RCTNSStringFromString(newViewProps.name); \
|
|
430
|
+
}
|
|
408
431
|
|
|
409
432
|
#define REMAP_MAPVIEW_COLOR_PROP(name) \
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
433
|
+
if (oldViewProps.name != newViewProps.name) { \
|
|
434
|
+
_view.name = RCTUIColorFromSharedColor(newViewProps.name); \
|
|
435
|
+
}
|
|
413
436
|
|
|
414
437
|
#define REMAP_MAPVIEW_POINT_PROP(name) \
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
438
|
+
if (newViewProps.name.x != oldViewProps.name.x || \
|
|
439
|
+
newViewProps.name.y != oldViewProps.name.y) { \
|
|
440
|
+
_view.name = CGPointMake(newViewProps.name.x, newViewProps.name.y); \
|
|
441
|
+
}
|
|
419
442
|
|
|
420
443
|
#define REMAP_MAPVIEW_REGION_PROP(name) \
|
|
421
|
-
|
|
422
|
-
|
|
444
|
+
if (!(newViewProps.name.latitude == 0 && \
|
|
445
|
+
newViewProps.name.longitude == 0 && \
|
|
446
|
+
newViewProps.name.latitudeDelta == 0 && \
|
|
447
|
+
newViewProps.name.longitudeDelta == 0)) { \
|
|
448
|
+
if (newViewProps.name.latitude != oldViewProps.name.latitude || \
|
|
449
|
+
newViewProps.name.longitude != oldViewProps.name.longitude || \
|
|
423
450
|
newViewProps.name.latitudeDelta != oldViewProps.name.latitudeDelta ||\
|
|
424
451
|
newViewProps.name.longitudeDelta != oldViewProps.name.longitudeDelta) { \
|
|
425
452
|
MKCoordinateSpan span = MKCoordinateSpanMake(newViewProps.name.latitudeDelta, \
|
|
426
453
|
newViewProps.name.longitudeDelta); \
|
|
427
454
|
MKCoordinateRegion region = MKCoordinateRegionMake(CLLocationCoordinate2DMake( \
|
|
428
|
-
|
|
455
|
+
newViewProps.name.latitude, \
|
|
456
|
+
newViewProps.name.longitude), span); \
|
|
429
457
|
_view.name = region; \
|
|
430
|
-
}
|
|
458
|
+
} \
|
|
459
|
+
}
|
|
460
|
+
|
|
431
461
|
|
|
432
462
|
#define REMAP_MAPVIEW_CAMERA_PROP(name) \
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
463
|
+
if (newViewProps.name.center.latitude != oldViewProps.name.center.latitude || \
|
|
464
|
+
newViewProps.name.center.longitude != oldViewProps.name.center.longitude || \
|
|
465
|
+
newViewProps.name.heading != oldViewProps.name.heading || \
|
|
466
|
+
newViewProps.name.pitch != oldViewProps.name.pitch) { \
|
|
467
|
+
CLLocationCoordinate2D center = CLLocationCoordinate2DMake( \
|
|
468
|
+
newViewProps.name.center.latitude, \
|
|
469
|
+
newViewProps.name.center.longitude); \
|
|
470
|
+
MKMapCamera* camera = [[MKMapCamera alloc] init]; \
|
|
471
|
+
camera.centerCoordinate = center; \
|
|
472
|
+
camera.heading = newViewProps.name.heading; \
|
|
473
|
+
camera.pitch = newViewProps.name.pitch; \
|
|
474
|
+
camera.centerCoordinateDistance = newViewProps.name.altitude; \
|
|
475
|
+
_view.name = camera; \
|
|
476
|
+
}
|
|
446
477
|
|
|
447
478
|
#define REMAP_MAPVIEW_EDGEINSETS_PROP(name) \
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
479
|
+
if (newViewProps.name.top != oldViewProps.name.top || \
|
|
480
|
+
newViewProps.name.right != oldViewProps.name.right || \
|
|
481
|
+
newViewProps.name.bottom != oldViewProps.name.bottom || \
|
|
482
|
+
newViewProps.name.left != oldViewProps.name.left) { \
|
|
483
|
+
_view.name = UIEdgeInsetsMake(newViewProps.name.top, \
|
|
484
|
+
newViewProps.name.left, \
|
|
485
|
+
newViewProps.name.bottom, \
|
|
486
|
+
newViewProps.name.right); \
|
|
487
|
+
}
|
|
457
488
|
|
|
458
489
|
#define REMAP_MAPVIEW_MAPTYPE(rnMapType) MKMapType##rnMapType
|
|
459
490
|
|
|
@@ -462,7 +493,9 @@ MKMapType mapRNTypeToMKMapType(RNMapsMapViewMapType rnMapType) {
|
|
|
462
493
|
|
|
463
494
|
REMAP_MAPVIEW_PROP(followsUserLocation)
|
|
464
495
|
REMAP_MAPVIEW_PROP(loadingEnabled)
|
|
496
|
+
|
|
465
497
|
REMAP_MAPVIEW_PROP(scrollEnabled)
|
|
498
|
+
REMAP_MAPVIEW_PROP(handlePanDrag)
|
|
466
499
|
|
|
467
500
|
REMAP_MAPVIEW_PROP(maxDelta)
|
|
468
501
|
REMAP_MAPVIEW_PROP(maxZoom)
|
|
@@ -471,15 +504,19 @@ MKMapType mapRNTypeToMKMapType(RNMapsMapViewMapType rnMapType) {
|
|
|
471
504
|
|
|
472
505
|
REMAP_MAPVIEW_PROP(showsCompass)
|
|
473
506
|
REMAP_MAPVIEW_PROP(showsScale)
|
|
474
|
-
REMAP_MAPVIEW_PROP(showsTraffic)
|
|
475
507
|
REMAP_MAPVIEW_PROP(showsUserLocation)
|
|
476
508
|
REMAP_MAPVIEW_PROP(userLocationCalloutEnabled)
|
|
477
509
|
REMAP_MAPVIEW_PROP(zoomEnabled)
|
|
478
510
|
|
|
511
|
+
|
|
479
512
|
REMAP_MAPVIEW_POINT_PROP(compassOffset)
|
|
480
513
|
|
|
481
|
-
|
|
482
|
-
|
|
514
|
+
if (![_view ignoreRegionChanges]){
|
|
515
|
+
_view.ignoreRegionChanges = YES;
|
|
516
|
+
REMAP_MAPVIEW_REGION_PROP(initialRegion)
|
|
517
|
+
REMAP_MAPVIEW_REGION_PROP(region)
|
|
518
|
+
_view.ignoreRegionChanges = NO;
|
|
519
|
+
}
|
|
483
520
|
|
|
484
521
|
REMAP_MAPVIEW_CAMERA_PROP(initialCamera)
|
|
485
522
|
REMAP_MAPVIEW_CAMERA_PROP(camera)
|
|
@@ -519,12 +556,12 @@ MKMapType mapRNTypeToMKMapType(RNMapsMapViewMapType rnMapType) {
|
|
|
519
556
|
}
|
|
520
557
|
|
|
521
558
|
|
|
522
|
-
|
|
559
|
+
[super updateProps:props oldProps:oldProps];
|
|
523
560
|
}
|
|
524
561
|
|
|
525
562
|
@end
|
|
526
563
|
|
|
527
564
|
Class<RCTComponentViewProtocol> RNMapsMapViewCls(void)
|
|
528
565
|
{
|
|
529
|
-
|
|
566
|
+
return RNMapsMapView.class;
|
|
530
567
|
}
|