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