react-native-maps 1.21.0-alpha.8 → 1.21.0-alpha.80
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/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/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 +27 -0
- package/android/generated/jni/react/renderer/components/RNMapsSpecs/ComponentDescriptors.h +29 -0
- package/android/generated/jni/react/renderer/components/RNMapsSpecs/EventEmitters.cpp +940 -0
- package/android/generated/jni/react/renderer/components/RNMapsSpecs/EventEmitters.h +809 -0
- package/android/generated/jni/react/renderer/components/RNMapsSpecs/Props.cpp +170 -0
- package/android/generated/jni/react/renderer/components/RNMapsSpecs/Props.h +1142 -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 +22 -0
- package/android/generated/jni/react/renderer/components/RNMapsSpecs/ShadowNodes.h +87 -0
- package/android/generated/jni/react/renderer/components/RNMapsSpecs/States.cpp +16 -0
- package/android/generated/jni/react/renderer/components/RNMapsSpecs/States.h +89 -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/JSONUtil.java +86 -0
- package/android/src/main/java/com/rnmaps/fabric/MapViewManager.java +618 -0
- package/android/src/main/java/com/rnmaps/fabric/MarkerManager.java +259 -0
- package/android/src/main/java/com/rnmaps/fabric/NativeAirMapsModule.java +156 -4
- 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/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 +30 -2
- package/android/src/main/java/com/rnmaps/maps/MapCallout.java +18 -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/MapPolygon.java +29 -0
- 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 +1649 -1336
- package/ios/AirGoogleMaps/AIRGoogleMap.h +3 -2
- package/ios/AirGoogleMaps/AIRGoogleMap.m +155 -50
- package/ios/AirGoogleMaps/AIRGoogleMapCircle.m +23 -11
- package/ios/AirGoogleMaps/AIRGoogleMapManager.m +17 -28
- 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.h +3 -3
- package/ios/AirGoogleMaps/RNMapsGoogleMapView.mm +201 -60
- package/ios/AirGoogleMaps/RNMapsGooglePolygonView.h +26 -0
- package/ios/AirGoogleMaps/RNMapsGooglePolygonView.mm +217 -0
- package/ios/AirGoogleMaps/RNMapsGooglePolygonViewManager.mm +25 -0
- package/ios/AirMaps/AIRMap.h +5 -2
- package/ios/AirMaps/AIRMap.m +285 -153
- 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 +42 -172
- package/ios/AirMaps/RNMapsAirModuleDelegate.h +24 -0
- package/ios/AirMaps/RNMapsHostVewDelegate.h +17 -0
- package/ios/AirMaps/RNMapsMapView.h +3 -3
- package/ios/AirMaps/RNMapsMapView.mm +340 -308
- package/ios/AirMaps/RNMapsMarkerView.h +24 -0
- package/ios/AirMaps/RNMapsMarkerView.mm +430 -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 +27 -0
- package/ios/generated/RNMapsSpecs/ComponentDescriptors.h +29 -0
- package/ios/generated/RNMapsSpecs/EventEmitters.cpp +940 -0
- package/ios/generated/RNMapsSpecs/EventEmitters.h +809 -0
- package/ios/generated/RNMapsSpecs/Props.cpp +170 -0
- package/ios/generated/RNMapsSpecs/Props.h +1142 -0
- package/ios/generated/RNMapsSpecs/RCTComponentViewHelpers.h +595 -0
- package/ios/generated/RNMapsSpecs/RNMapsSpecs-generated.mm +92 -0
- package/ios/generated/RNMapsSpecs/RNMapsSpecs.h +137 -0
- package/ios/generated/RNMapsSpecs/ShadowNodes.cpp +22 -0
- package/ios/generated/RNMapsSpecs/ShadowNodes.h +87 -0
- package/ios/generated/RNMapsSpecs/States.cpp +16 -0
- package/ios/generated/RNMapsSpecs/States.h +89 -0
- package/ios/generated/RNMapsSpecsJSI-generated.cpp +74 -0
- package/ios/generated/RNMapsSpecsJSI.h +268 -0
- package/ios/generated/ReactAppDependencyProvider.podspec +34 -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 +53 -9
- package/lib/MapMarkerNativeComponent.js +0 -2
- package/lib/MapOverlay.js +2 -8
- package/lib/MapPolygon.d.ts +1 -1
- package/lib/MapPolyline.d.ts +7 -7
- package/lib/MapView.d.ts +14 -27
- package/lib/MapView.js +97 -103
- package/lib/MapView.types.d.ts +1 -1
- package/lib/createFabricMap.d.ts +1 -0
- package/lib/createFabricMap.js +15 -2
- package/lib/decorateMapComponent.js +30 -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/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/NativeComponentPolyline.d.ts +101 -0
- package/lib/specs/NativeComponentPolyline.js +7 -0
- package/package.json +25 -20
- package/react-native-maps.podspec +2 -1
|
@@ -7,16 +7,17 @@
|
|
|
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/
|
|
17
|
-
|
|
13
|
+
#import "RNMapsMarkerView.h"
|
|
14
|
+
#import <react-native-maps-generated/ComponentDescriptors.h>
|
|
15
|
+
#import <react-native-maps-generated/EventEmitters.h>
|
|
16
|
+
#import <react-native-maps-generated/Props.h>
|
|
17
|
+
#import <react-native-maps-generated/RCTComponentViewHelpers.h>
|
|
18
18
|
#import "RCTFabricComponentsPlugins.h"
|
|
19
19
|
#import <React/RCTConversions.h>
|
|
20
|
+
#import "UIView+AirMap.h"
|
|
20
21
|
|
|
21
22
|
using namespace facebook::react;
|
|
22
23
|
|
|
@@ -29,16 +30,26 @@ using namespace facebook::react;
|
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
|
|
32
|
-
- (
|
|
33
|
+
- (id<RNMapsAirModuleDelegate>) mapView {
|
|
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,288 +107,297 @@ 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.onChange = [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); \
|
|
360
340
|
}
|
|
361
341
|
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
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];
|
|
367
370
|
}
|
|
368
|
-
|
|
369
|
-
return
|
|
371
|
+
|
|
372
|
+
return self;
|
|
370
373
|
}
|
|
371
374
|
|
|
375
|
+
|
|
372
376
|
- (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index{
|
|
373
|
-
id<RCTComponent> paperView = [
|
|
377
|
+
id<RCTComponent> paperView = [childComponentView getPaperViewFromChildComponentView];
|
|
374
378
|
if (paperView){
|
|
375
379
|
[_view insertReactSubview:paperView atIndex:index];
|
|
380
|
+
} else if ([childComponentView isKindOfClass:[RNMapsMarkerView class]]){
|
|
381
|
+
RNMapsMarkerView* fabricMarker = (RNMapsMarkerView *) childComponentView;
|
|
382
|
+
[_view insertReactSubview:[fabricMarker marker] atIndex:index];
|
|
383
|
+
}
|
|
384
|
+
else {
|
|
385
|
+
[_view insertReactSubview:childComponentView atIndex:index];
|
|
376
386
|
}
|
|
377
387
|
}
|
|
388
|
+
|
|
378
389
|
- (void) unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
|
|
379
390
|
{
|
|
380
|
-
id<RCTComponent> paperView = [
|
|
391
|
+
id<RCTComponent> paperView = [childComponentView getPaperViewFromChildComponentView];
|
|
381
392
|
if (paperView){
|
|
382
393
|
[_view removeReactSubview:paperView];
|
|
383
394
|
}
|
|
395
|
+
else if ([childComponentView isKindOfClass:[RNMapsMarkerView class]]){
|
|
396
|
+
RNMapsMarkerView* fabricMarker = (RNMapsMarkerView *) childComponentView;
|
|
397
|
+
[_view removeReactSubview:[fabricMarker marker]];
|
|
398
|
+
} else {
|
|
399
|
+
[_view removeReactSubview:childComponentView];
|
|
400
|
+
}
|
|
384
401
|
}
|
|
385
402
|
|
|
386
403
|
MKMapType mapRNTypeToMKMapType(RNMapsMapViewMapType rnMapType) {
|
|
@@ -398,67 +415,76 @@ MKMapType mapRNTypeToMKMapType(RNMapsMapViewMapType rnMapType) {
|
|
|
398
415
|
|
|
399
416
|
- (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
|
|
400
417
|
{
|
|
401
|
-
|
|
402
|
-
|
|
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);
|
|
403
421
|
|
|
404
422
|
#define REMAP_MAPVIEW_PROP(name) \
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
423
|
+
if (oldViewProps.name != newViewProps.name) { \
|
|
424
|
+
_view.name = newViewProps.name; \
|
|
425
|
+
}
|
|
408
426
|
|
|
409
427
|
#define REMAP_MAPVIEW_STRING_PROP(name) \
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
428
|
+
if (oldViewProps.name != newViewProps.name) { \
|
|
429
|
+
_view.name = RCTNSStringFromString(newViewProps.name); \
|
|
430
|
+
}
|
|
413
431
|
|
|
414
432
|
#define REMAP_MAPVIEW_COLOR_PROP(name) \
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
433
|
+
if (oldViewProps.name != newViewProps.name) { \
|
|
434
|
+
_view.name = RCTUIColorFromSharedColor(newViewProps.name); \
|
|
435
|
+
}
|
|
418
436
|
|
|
419
437
|
#define REMAP_MAPVIEW_POINT_PROP(name) \
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
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
|
+
}
|
|
424
442
|
|
|
425
443
|
#define REMAP_MAPVIEW_REGION_PROP(name) \
|
|
426
|
-
|
|
427
|
-
|
|
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 || \
|
|
428
450
|
newViewProps.name.latitudeDelta != oldViewProps.name.latitudeDelta ||\
|
|
429
451
|
newViewProps.name.longitudeDelta != oldViewProps.name.longitudeDelta) { \
|
|
430
452
|
MKCoordinateSpan span = MKCoordinateSpanMake(newViewProps.name.latitudeDelta, \
|
|
431
453
|
newViewProps.name.longitudeDelta); \
|
|
432
454
|
MKCoordinateRegion region = MKCoordinateRegionMake(CLLocationCoordinate2DMake( \
|
|
433
|
-
|
|
455
|
+
newViewProps.name.latitude, \
|
|
456
|
+
newViewProps.name.longitude), span); \
|
|
434
457
|
_view.name = region; \
|
|
435
|
-
}
|
|
458
|
+
} \
|
|
459
|
+
}
|
|
460
|
+
|
|
436
461
|
|
|
437
462
|
#define REMAP_MAPVIEW_CAMERA_PROP(name) \
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
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
|
+
}
|
|
451
477
|
|
|
452
478
|
#define REMAP_MAPVIEW_EDGEINSETS_PROP(name) \
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
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
|
+
}
|
|
462
488
|
|
|
463
489
|
#define REMAP_MAPVIEW_MAPTYPE(rnMapType) MKMapType##rnMapType
|
|
464
490
|
|
|
@@ -467,7 +493,9 @@ MKMapType mapRNTypeToMKMapType(RNMapsMapViewMapType rnMapType) {
|
|
|
467
493
|
|
|
468
494
|
REMAP_MAPVIEW_PROP(followsUserLocation)
|
|
469
495
|
REMAP_MAPVIEW_PROP(loadingEnabled)
|
|
496
|
+
|
|
470
497
|
REMAP_MAPVIEW_PROP(scrollEnabled)
|
|
498
|
+
REMAP_MAPVIEW_PROP(handlePanDrag)
|
|
471
499
|
|
|
472
500
|
REMAP_MAPVIEW_PROP(maxDelta)
|
|
473
501
|
REMAP_MAPVIEW_PROP(maxZoom)
|
|
@@ -476,15 +504,19 @@ MKMapType mapRNTypeToMKMapType(RNMapsMapViewMapType rnMapType) {
|
|
|
476
504
|
|
|
477
505
|
REMAP_MAPVIEW_PROP(showsCompass)
|
|
478
506
|
REMAP_MAPVIEW_PROP(showsScale)
|
|
479
|
-
REMAP_MAPVIEW_PROP(showsTraffic)
|
|
480
507
|
REMAP_MAPVIEW_PROP(showsUserLocation)
|
|
481
508
|
REMAP_MAPVIEW_PROP(userLocationCalloutEnabled)
|
|
482
509
|
REMAP_MAPVIEW_PROP(zoomEnabled)
|
|
483
510
|
|
|
511
|
+
|
|
484
512
|
REMAP_MAPVIEW_POINT_PROP(compassOffset)
|
|
485
513
|
|
|
486
|
-
|
|
487
|
-
|
|
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
|
+
}
|
|
488
520
|
|
|
489
521
|
REMAP_MAPVIEW_CAMERA_PROP(initialCamera)
|
|
490
522
|
REMAP_MAPVIEW_CAMERA_PROP(camera)
|
|
@@ -524,12 +556,12 @@ MKMapType mapRNTypeToMKMapType(RNMapsMapViewMapType rnMapType) {
|
|
|
524
556
|
}
|
|
525
557
|
|
|
526
558
|
|
|
527
|
-
|
|
559
|
+
[super updateProps:props oldProps:oldProps];
|
|
528
560
|
}
|
|
529
561
|
|
|
530
562
|
@end
|
|
531
563
|
|
|
532
564
|
Class<RCTComponentViewProtocol> RNMapsMapViewCls(void)
|
|
533
565
|
{
|
|
534
|
-
|
|
566
|
+
return RNMapsMapView.class;
|
|
535
567
|
}
|