react-native-maps 1.21.0-alpha.7 → 1.21.0-alpha.71
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 +38 -13
- 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 +17 -0
- package/android/generated/java/com/facebook/react/viewmanagers/RNMapsMapViewManagerDelegate.java +200 -0
- package/android/generated/java/com/facebook/react/viewmanagers/RNMapsMapViewManagerInterface.java +71 -0
- package/android/generated/java/com/facebook/react/viewmanagers/RNMapsMarkerManagerDelegate.java +104 -0
- package/android/generated/java/com/facebook/react/viewmanagers/RNMapsMarkerManagerInterface.java +39 -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 +26 -0
- package/android/generated/jni/react/renderer/components/RNMapsSpecs/ComponentDescriptors.h +28 -0
- package/android/generated/jni/react/renderer/components/RNMapsSpecs/EventEmitters.cpp +918 -0
- package/android/generated/jni/react/renderer/components/RNMapsSpecs/EventEmitters.h +787 -0
- package/android/generated/jni/react/renderer/components/RNMapsSpecs/Props.cpp +154 -0
- package/android/generated/jni/react/renderer/components/RNMapsSpecs/Props.h +1058 -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 +21 -0
- package/android/generated/jni/react/renderer/components/RNMapsSpecs/ShadowNodes.h +76 -0
- package/android/generated/jni/react/renderer/components/RNMapsSpecs/States.cpp +16 -0
- package/android/generated/jni/react/renderer/components/RNMapsSpecs/States.h +77 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- 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 +593 -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/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/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/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/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 +22 -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/MapView.java +1618 -1346
- package/ios/AirGoogleMaps/AIRGoogleMap.h +3 -2
- package/ios/AirGoogleMaps/AIRGoogleMap.m +153 -48
- 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.h +3 -0
- package/ios/AirGoogleMaps/RCTConvert+GMSMapViewType.m +2 -0
- package/ios/AirGoogleMaps/RNMapsGoogleMapView.h +3 -3
- package/ios/AirGoogleMaps/RNMapsGoogleMapView.mm +161 -61
- 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 +6 -3
- package/ios/AirMaps/AIRMap.m +289 -145
- package/ios/AirMaps/AIRMapManager.m +8 -17
- 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/RCTConvert+AirMap.h +4 -0
- package/ios/AirMaps/RCTConvert+AirMap.m +2 -0
- 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 +344 -307
- 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 +26 -0
- package/ios/generated/RNMapsSpecs/ComponentDescriptors.h +28 -0
- package/ios/generated/RNMapsSpecs/EventEmitters.cpp +918 -0
- package/ios/generated/RNMapsSpecs/EventEmitters.h +787 -0
- package/ios/generated/RNMapsSpecs/Props.cpp +154 -0
- package/ios/generated/RNMapsSpecs/Props.h +1058 -0
- package/ios/generated/RNMapsSpecs/RCTComponentViewHelpers.h +549 -0
- package/ios/generated/RNMapsSpecs/RNMapsSpecs-generated.mm +92 -0
- package/ios/generated/RNMapsSpecs/RNMapsSpecs.h +137 -0
- package/ios/generated/RNMapsSpecs/ShadowNodes.cpp +21 -0
- package/ios/generated/RNMapsSpecs/ShadowNodes.h +76 -0
- package/ios/generated/RNMapsSpecs/States.cpp +16 -0
- package/ios/generated/RNMapsSpecs/States.h +77 -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/MapCallout.js +1 -0
- package/lib/MapMarker.d.ts +15 -2
- package/lib/MapMarker.js +53 -9
- package/lib/MapMarkerNativeComponent.js +0 -2
- package/lib/MapOverlay.js +2 -8
- package/lib/MapPolyline.d.ts +1 -1
- package/lib/MapView.d.ts +7 -22
- package/lib/MapView.js +83 -94
- package/lib/{FabricMapView.d.ts → createFabricMap.d.ts} +7 -11
- package/lib/createFabricMap.js +175 -0
- package/lib/decorateMapComponent.js +22 -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 +12 -12
- package/lib/specs/NativeComponentGooglePolygon.d.ts +75 -0
- package/lib/specs/NativeComponentGooglePolygon.js +9 -0
- package/lib/specs/NativeComponentMapView.d.ts +19 -36
- package/lib/specs/NativeComponentMapView.js +1 -3
- package/lib/specs/NativeComponentMarker.d.ts +258 -0
- package/lib/specs/NativeComponentMarker.js +19 -0
- package/package.json +15 -10
- package/react-native-maps.podspec +2 -1
- package/lib/FabricMapView.js +0 -181
|
@@ -10,13 +10,14 @@
|
|
|
10
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,9 +77,18 @@ 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 {
|
|
82
|
+
NSArray* coordinatesArr = [RCTConvert arrayFromString:coordinatesJSON];
|
|
83
|
+
NSMutableArray<AIRMapCoordinate*>* mutableArray = [NSMutableArray new];
|
|
84
|
+
for (id json : coordinatesArr){
|
|
85
|
+
[mutableArray addObject:[RCTConvert AIRMapCoordinate:json]];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
NSDictionary* edgePadding = [RCTConvert dictonaryFromString:edgePaddingJSON];
|
|
89
|
+
|
|
90
|
+
UIEdgeInsets edgeInsets = [RCTConvert UIEdgeInsets:edgePadding];
|
|
91
|
+
[_view fitToCoordinates:mutableArray edgePadding:edgeInsets animated:animated];
|
|
79
92
|
|
|
80
93
|
}
|
|
81
94
|
|
|
@@ -89,288 +102,297 @@ using namespace facebook::react;
|
|
|
89
102
|
|
|
90
103
|
+ (ComponentDescriptorProvider)componentDescriptorProvider
|
|
91
104
|
{
|
|
92
|
-
|
|
105
|
+
return concreteComponentDescriptorProvider<RNMapsMapViewComponentDescriptor>();
|
|
93
106
|
}
|
|
94
107
|
|
|
95
|
-
|
|
96
|
-
- (instancetype)initWithFrame:(CGRect)frame
|
|
108
|
+
- (void) prepareMapView
|
|
97
109
|
{
|
|
98
|
-
|
|
110
|
+
if (_legacyMapManager && _view) return;
|
|
99
111
|
static const auto defaultProps = std::make_shared<const RNMapsMapViewProps>();
|
|
100
112
|
_props = defaultProps;
|
|
101
|
-
|
|
113
|
+
_legacyMapManager = [[AIRMapManager alloc] init];
|
|
102
114
|
_view = (AIRMap *)[_legacyMapManager view];
|
|
103
115
|
|
|
104
116
|
self.contentView = _view;
|
|
105
117
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
_view.onMapReady = [self](NSDictionary* dictionary) {
|
|
136
|
-
if (_eventEmitter) {
|
|
137
|
-
|
|
138
|
-
auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
|
|
139
|
-
facebook::react::RNMapsMapViewEventEmitter::OnMapReady data = {};
|
|
140
|
-
mapViewEventEmitter->onMapReady(data);
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
_view.onChange = [self](NSDictionary* dictionary) {
|
|
144
|
-
if (_eventEmitter) {
|
|
145
|
-
|
|
146
|
-
NSDictionary* regionDict = dictionary[@"region"];
|
|
147
|
-
auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
|
|
148
|
-
facebook::react::RNMapsMapViewEventEmitter::OnRegionChange data = {
|
|
149
|
-
.region.latitude = [regionDict[@"latitude"] doubleValue],
|
|
150
|
-
.region.longitude = [regionDict[@"longitude"] doubleValue],
|
|
151
|
-
.region.latitudeDelta = [regionDict[@"latitudeDelta"] doubleValue],
|
|
152
|
-
.region.longitudeDelta = [regionDict[@"longitudeDelta"] doubleValue],
|
|
153
|
-
.continuous = [dictionary[@"continuous"] boolValue],
|
|
154
|
-
};
|
|
155
|
-
mapViewEventEmitter->onRegionChange(data);
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
|
-
_view.onDoublePress = [self](NSDictionary* dictionary) {
|
|
159
|
-
if (_eventEmitter) {
|
|
160
|
-
|
|
161
|
-
NSDictionary* coordinateDict = dictionary[@"coordinate"];
|
|
162
|
-
NSDictionary* positionDict = dictionary[@"position"];
|
|
163
|
-
|
|
164
|
-
// Populate the OnMapPressCoordinate struct
|
|
165
|
-
facebook::react::RNMapsMapViewEventEmitter::OnDoublePressCoordinate coordinate = {
|
|
166
|
-
.latitude = [coordinateDict[@"latitude"] doubleValue],
|
|
167
|
-
.longitude = [coordinateDict[@"longitude"] doubleValue],
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
// Populate the OnMapDouplePressPosition struct
|
|
171
|
-
facebook::react::RNMapsMapViewEventEmitter::OnDoublePressPosition position = {
|
|
172
|
-
.x = [positionDict[@"x"] doubleValue],
|
|
173
|
-
.y = [positionDict[@"y"] doubleValue],
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
|
|
178
|
-
facebook::react::RNMapsMapViewEventEmitter::OnDoublePress data = {
|
|
179
|
-
.position = position,
|
|
180
|
-
.coordinate = coordinate
|
|
181
|
-
};
|
|
182
|
-
mapViewEventEmitter->onDoublePress(data);
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
_view.onPanDrag = [self](NSDictionary* dictionary) {
|
|
187
|
-
if (_eventEmitter) {
|
|
188
|
-
|
|
189
|
-
NSDictionary* coordinateDict = dictionary[@"coordinate"];
|
|
190
|
-
NSDictionary* positionDict = dictionary[@"position"];
|
|
191
|
-
|
|
192
|
-
// Populate the OnMapPressCoordinate struct
|
|
193
|
-
facebook::react::RNMapsMapViewEventEmitter::OnPanDragCoordinate coordinate = {
|
|
194
|
-
.latitude = [coordinateDict[@"latitude"] doubleValue],
|
|
195
|
-
.longitude = [coordinateDict[@"longitude"] doubleValue],
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
// Populate the OnMapDouplePressPosition struct
|
|
199
|
-
facebook::react::RNMapsMapViewEventEmitter::OnPanDragPosition position = {
|
|
200
|
-
.x = [positionDict[@"x"] doubleValue],
|
|
201
|
-
.y = [positionDict[@"y"] doubleValue],
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
|
|
205
|
-
facebook::react::RNMapsMapViewEventEmitter::OnPanDrag data = {
|
|
206
|
-
.position = position,
|
|
207
|
-
.coordinate = coordinate,
|
|
208
|
-
};
|
|
209
|
-
mapViewEventEmitter->onPanDrag(data);
|
|
210
|
-
}
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
_view.onUserLocationChange = [self](NSDictionary* dictionary) {
|
|
214
|
-
if (_eventEmitter) {
|
|
215
|
-
|
|
216
|
-
NSDictionary* coordinateDict = dictionary[@"coordinate"];
|
|
217
|
-
NSDictionary* errorDict = dictionary[@"error"];
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
// Populate the OnMapPressCoordinate struct
|
|
221
|
-
facebook::react::RNMapsMapViewEventEmitter::OnUserLocationChangeCoordinate coordinate = {
|
|
222
|
-
.latitude = [coordinateDict[@"latitude"] doubleValue],
|
|
223
|
-
.longitude = [coordinateDict[@"longitude"] doubleValue],
|
|
224
|
-
};
|
|
225
|
-
facebook::react::RNMapsMapViewEventEmitter::OnUserLocationChangeError error = {
|
|
226
|
-
.message = std::string([errorDict[@"message"] UTF8String]),
|
|
227
|
-
};
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
|
|
231
|
-
facebook::react::RNMapsMapViewEventEmitter::OnUserLocationChange data = {
|
|
232
|
-
.coordinate = coordinate,
|
|
233
|
-
.error = error,
|
|
234
|
-
};
|
|
235
|
-
mapViewEventEmitter->onUserLocationChange(data);
|
|
236
|
-
}
|
|
237
|
-
};
|
|
238
|
-
|
|
239
|
-
_view.onCalloutPress = [self](NSDictionary* dictionary) {
|
|
240
|
-
if (_eventEmitter) {
|
|
241
|
-
|
|
242
|
-
NSDictionary* coordinateDict = dictionary[@"coordinate"];
|
|
243
|
-
NSDictionary* positionDict = dictionary[@"position"];
|
|
244
|
-
|
|
245
|
-
// Populate the OnCalloutPressPoint struct
|
|
246
|
-
facebook::react::RNMapsMapViewEventEmitter::OnCalloutPressPoint point = {
|
|
247
|
-
.x = [coordinateDict[@"x"] doubleValue],
|
|
248
|
-
.y = [coordinateDict[@"y"] doubleValue],
|
|
249
|
-
};
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
facebook::react::RNMapsMapViewEventEmitter::OnCalloutPressFrame frame = {
|
|
253
|
-
.x = [positionDict[@"x"] doubleValue],
|
|
254
|
-
.y = [positionDict[@"y"] doubleValue],
|
|
255
|
-
.width = [positionDict[@"width"] doubleValue],
|
|
256
|
-
.height = [positionDict[@"height"] doubleValue],
|
|
257
|
-
};
|
|
258
|
-
|
|
259
|
-
auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
|
|
260
|
-
facebook::react::RNMapsMapViewEventEmitter::OnCalloutPress data = {
|
|
261
|
-
.action = std::string([dictionary[@"action"] UTF8String]),
|
|
262
|
-
.id = std::string([dictionary[@"id"] UTF8String]),
|
|
263
|
-
.point = point,
|
|
264
|
-
.frame = frame,
|
|
265
|
-
};
|
|
266
|
-
mapViewEventEmitter->onCalloutPress(data);
|
|
267
|
-
}
|
|
268
|
-
};
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
_view.onRegionChangeStart = [self](NSDictionary* dictionary) {
|
|
272
|
-
if (_eventEmitter) {
|
|
273
|
-
|
|
274
|
-
NSDictionary* regionDict = dictionary[@"region"];
|
|
275
|
-
auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
|
|
276
|
-
facebook::react::RNMapsMapViewEventEmitter::OnRegionChangeStart data = {
|
|
277
|
-
.region.latitude = [regionDict[@"latitude"] doubleValue],
|
|
278
|
-
.region.longitude = [regionDict[@"longitude"] doubleValue],
|
|
279
|
-
.region.latitudeDelta = [regionDict[@"latitudeDelta"] doubleValue],
|
|
280
|
-
.region.longitudeDelta = [regionDict[@"longitudeDelta"] doubleValue],
|
|
281
|
-
.continuous = [dictionary[@"continuous"] boolValue],
|
|
282
|
-
};
|
|
283
|
-
mapViewEventEmitter->onRegionChangeStart(data);
|
|
284
|
-
}
|
|
285
|
-
};
|
|
118
|
+
_view.onPress = [self](NSDictionary* dictionary) {
|
|
119
|
+
if (_eventEmitter) {
|
|
120
|
+
// Extract values from the NSDictionary
|
|
121
|
+
NSDictionary* coordinateDict = dictionary[@"coordinate"];
|
|
122
|
+
NSDictionary* positionDict = dictionary[@"position"];
|
|
123
|
+
|
|
124
|
+
// Populate the OnMapPressCoordinate struct
|
|
125
|
+
facebook::react::RNMapsMapViewEventEmitter::OnPressCoordinate coordinate = {
|
|
126
|
+
.latitude = [coordinateDict[@"latitude"] doubleValue],
|
|
127
|
+
.longitude = [coordinateDict[@"longitude"] doubleValue],
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
// Populate the OnMapPressPosition struct
|
|
131
|
+
facebook::react::RNMapsMapViewEventEmitter::OnPressPosition position = {
|
|
132
|
+
.x = [positionDict[@"x"] doubleValue],
|
|
133
|
+
.y = [positionDict[@"y"] doubleValue],
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
|
|
137
|
+
facebook::react::RNMapsMapViewEventEmitter::OnPress data = {
|
|
138
|
+
.action = std::string([@"press" UTF8String]),
|
|
139
|
+
.position = position,
|
|
140
|
+
.coordinate = coordinate
|
|
141
|
+
};
|
|
142
|
+
mapViewEventEmitter->onPress(data);
|
|
143
|
+
}
|
|
144
|
+
};
|
|
286
145
|
|
|
287
146
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
NSDictionary* coordinateDict = dictionary[@"coordinate"]; \
|
|
291
|
-
auto mapViewEventEmitter = \
|
|
292
|
-
std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter); \
|
|
293
|
-
facebook::react::RNMapsMapViewEventEmitter::eventName data = { \
|
|
294
|
-
.coordinate.latitude = [coordinateDict[@"latitude"] doubleValue], \
|
|
295
|
-
.coordinate.longitude = [coordinateDict[@"longitude"] doubleValue], \
|
|
296
|
-
.id = std::string([[dictionary valueForKey:@"id"] UTF8String]), \
|
|
297
|
-
}; \
|
|
298
|
-
mapViewEventEmitter->emitterFunction(data); \
|
|
299
|
-
}
|
|
147
|
+
_view.onMapReady = [self](NSDictionary* dictionary) {
|
|
148
|
+
if (_eventEmitter) {
|
|
300
149
|
|
|
150
|
+
auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
|
|
151
|
+
facebook::react::RNMapsMapViewEventEmitter::OnMapReady data = {};
|
|
152
|
+
mapViewEventEmitter->onMapReady(data);
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
_view.onChange = [self](NSDictionary* dictionary) {
|
|
156
|
+
if (_eventEmitter) {
|
|
157
|
+
NSDictionary* regionDict = dictionary[@"region"];
|
|
158
|
+
auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
|
|
159
|
+
facebook::react::RNMapsMapViewEventEmitter::OnRegionChange data = {
|
|
160
|
+
.region.latitude = [regionDict[@"latitude"] doubleValue],
|
|
161
|
+
.region.longitude = [regionDict[@"longitude"] doubleValue],
|
|
162
|
+
.region.latitudeDelta = [regionDict[@"latitudeDelta"] doubleValue],
|
|
163
|
+
.region.longitudeDelta = [regionDict[@"longitudeDelta"] doubleValue],
|
|
164
|
+
.continuous = [dictionary[@"continuous"] boolValue],
|
|
165
|
+
};
|
|
166
|
+
mapViewEventEmitter->onRegionChange(data);
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
_view.onDoublePress = [self](NSDictionary* dictionary) {
|
|
170
|
+
if (_eventEmitter) {
|
|
171
|
+
|
|
172
|
+
NSDictionary* coordinateDict = dictionary[@"coordinate"];
|
|
173
|
+
NSDictionary* positionDict = dictionary[@"position"];
|
|
174
|
+
|
|
175
|
+
// Populate the OnMapPressCoordinate struct
|
|
176
|
+
facebook::react::RNMapsMapViewEventEmitter::OnDoublePressCoordinate coordinate = {
|
|
177
|
+
.latitude = [coordinateDict[@"latitude"] doubleValue],
|
|
178
|
+
.longitude = [coordinateDict[@"longitude"] doubleValue],
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
// Populate the OnMapDouplePressPosition struct
|
|
182
|
+
facebook::react::RNMapsMapViewEventEmitter::OnDoublePressPosition position = {
|
|
183
|
+
.x = [positionDict[@"x"] doubleValue],
|
|
184
|
+
.y = [positionDict[@"y"] doubleValue],
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
|
|
189
|
+
facebook::react::RNMapsMapViewEventEmitter::OnDoublePress data = {
|
|
190
|
+
.position = position,
|
|
191
|
+
.coordinate = coordinate
|
|
192
|
+
};
|
|
193
|
+
mapViewEventEmitter->onDoublePress(data);
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
_view.onPanDrag = [self](NSDictionary* dictionary) {
|
|
198
|
+
if (_eventEmitter) {
|
|
199
|
+
|
|
200
|
+
NSDictionary* coordinateDict = dictionary[@"coordinate"];
|
|
201
|
+
NSDictionary* positionDict = dictionary[@"position"];
|
|
202
|
+
|
|
203
|
+
// Populate the OnMapPressCoordinate struct
|
|
204
|
+
facebook::react::RNMapsMapViewEventEmitter::OnPanDragCoordinate coordinate = {
|
|
205
|
+
.latitude = [coordinateDict[@"latitude"] doubleValue],
|
|
206
|
+
.longitude = [coordinateDict[@"longitude"] doubleValue],
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
// Populate the OnMapDouplePressPosition struct
|
|
210
|
+
facebook::react::RNMapsMapViewEventEmitter::OnPanDragPosition position = {
|
|
211
|
+
.x = [positionDict[@"x"] doubleValue],
|
|
212
|
+
.y = [positionDict[@"y"] doubleValue],
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
|
|
216
|
+
facebook::react::RNMapsMapViewEventEmitter::OnPanDrag data = {
|
|
217
|
+
.position = position,
|
|
218
|
+
.coordinate = coordinate,
|
|
219
|
+
};
|
|
220
|
+
mapViewEventEmitter->onPanDrag(data);
|
|
221
|
+
}
|
|
222
|
+
};
|
|
301
223
|
|
|
224
|
+
_view.onUserLocationChange = [self](NSDictionary* dictionary) {
|
|
225
|
+
if (_eventEmitter) {
|
|
302
226
|
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
NSDictionary* coordinateDict = dictionary[@"coordinate"]; \
|
|
306
|
-
facebook::react::RNMapsMapViewEventEmitter::eventName##Coordinate coordinate = { \
|
|
307
|
-
.latitude = [coordinateDict[@"latitude"] doubleValue], \
|
|
308
|
-
.longitude = [coordinateDict[@"longitude"] doubleValue], \
|
|
309
|
-
}; \
|
|
310
|
-
\
|
|
311
|
-
auto mapViewEventEmitter = \
|
|
312
|
-
std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter); \
|
|
313
|
-
facebook::react::RNMapsMapViewEventEmitter::eventName data = { \
|
|
314
|
-
.action = std::string([@actionName UTF8String]), \
|
|
315
|
-
.id = std::string([[dictionary valueForKey:@"id"] UTF8String]), \
|
|
316
|
-
.coordinate = coordinate \
|
|
317
|
-
}; \
|
|
318
|
-
mapViewEventEmitter->emitterFunction(data); \
|
|
319
|
-
}
|
|
227
|
+
NSDictionary* coordinateDict = dictionary[@"coordinate"];
|
|
228
|
+
NSDictionary* errorDict = dictionary[@"error"];
|
|
320
229
|
|
|
321
|
-
_view.onMarkerDrag = [self](NSDictionary* dictionary) {
|
|
322
|
-
HANDLE_MARKER_DRAG_EVENT(OnMarkerDrag, onMarkerDrag);
|
|
323
|
-
};
|
|
324
230
|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
231
|
+
// Populate the OnMapPressCoordinate struct
|
|
232
|
+
facebook::react::RNMapsMapViewEventEmitter::OnUserLocationChangeCoordinate coordinate = {
|
|
233
|
+
.latitude = [coordinateDict[@"latitude"] doubleValue],
|
|
234
|
+
.longitude = [coordinateDict[@"longitude"] doubleValue],
|
|
235
|
+
};
|
|
236
|
+
NSString* str = @"";
|
|
237
|
+
if (errorDict){
|
|
238
|
+
str = errorDict[@"message"];
|
|
239
|
+
}
|
|
328
240
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
241
|
+
facebook::react::RNMapsMapViewEventEmitter::OnUserLocationChangeError error = {
|
|
242
|
+
.message = std::string([str UTF8String]),
|
|
243
|
+
};
|
|
332
244
|
|
|
333
|
-
_view.onMarkerSelect = [self](NSDictionary* dictionary) {
|
|
334
|
-
HANDLE_MARKER_EVENT(OnMarkerSelect, onMarkerSelect, "marker-select");
|
|
335
|
-
};
|
|
336
245
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
246
|
+
auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
|
|
247
|
+
facebook::react::RNMapsMapViewEventEmitter::OnUserLocationChange data = {
|
|
248
|
+
.coordinate = coordinate,
|
|
249
|
+
.error = error,
|
|
250
|
+
};
|
|
251
|
+
mapViewEventEmitter->onUserLocationChange(data);
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
_view.onCalloutPress = [self](NSDictionary* dictionary) {
|
|
256
|
+
if (_eventEmitter) {
|
|
257
|
+
|
|
258
|
+
NSDictionary* coordinateDict = dictionary[@"coordinate"];
|
|
259
|
+
NSDictionary* positionDict = dictionary[@"position"];
|
|
260
|
+
|
|
261
|
+
// Populate the OnCalloutPressPoint struct
|
|
262
|
+
facebook::react::RNMapsMapViewEventEmitter::OnCalloutPressPoint point = {
|
|
263
|
+
.x = [coordinateDict[@"x"] doubleValue],
|
|
264
|
+
.y = [coordinateDict[@"y"] doubleValue],
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
facebook::react::RNMapsMapViewEventEmitter::OnCalloutPressFrame frame = {
|
|
269
|
+
.x = [positionDict[@"x"] doubleValue],
|
|
270
|
+
.y = [positionDict[@"y"] doubleValue],
|
|
271
|
+
.width = [positionDict[@"width"] doubleValue],
|
|
272
|
+
.height = [positionDict[@"height"] doubleValue],
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
|
|
276
|
+
facebook::react::RNMapsMapViewEventEmitter::OnCalloutPress data = {
|
|
277
|
+
.action = std::string([dictionary[@"action"] UTF8String]),
|
|
278
|
+
.id = std::string([dictionary[@"id"] UTF8String]),
|
|
279
|
+
.point = point,
|
|
280
|
+
.frame = frame,
|
|
281
|
+
};
|
|
282
|
+
mapViewEventEmitter->onCalloutPress(data);
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
_view.onRegionChangeStart = [self](NSDictionary* dictionary) {
|
|
288
|
+
if (_eventEmitter) {
|
|
289
|
+
|
|
290
|
+
NSDictionary* regionDict = dictionary[@"region"];
|
|
291
|
+
auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
|
|
292
|
+
facebook::react::RNMapsMapViewEventEmitter::OnRegionChangeStart data = {
|
|
293
|
+
.region.latitude = [regionDict[@"latitude"] doubleValue],
|
|
294
|
+
.region.longitude = [regionDict[@"longitude"] doubleValue],
|
|
295
|
+
.region.latitudeDelta = [regionDict[@"latitudeDelta"] doubleValue],
|
|
296
|
+
.region.longitudeDelta = [regionDict[@"longitudeDelta"] doubleValue],
|
|
297
|
+
.continuous = [dictionary[@"continuous"] boolValue],
|
|
298
|
+
};
|
|
299
|
+
mapViewEventEmitter->onRegionChangeStart(data);
|
|
300
|
+
}
|
|
301
|
+
};
|
|
340
302
|
|
|
341
|
-
_view.onMarkerPress = [self](NSDictionary* dictionary) {
|
|
342
|
-
HANDLE_MARKER_EVENT(OnMarkerPress, onMarkerPress, "marker-press");
|
|
343
|
-
};
|
|
344
303
|
|
|
304
|
+
#define HANDLE_MARKER_DRAG_EVENT(eventName, emitterFunction) \
|
|
305
|
+
if (_eventEmitter) { \
|
|
306
|
+
NSDictionary* coordinateDict = dictionary[@"coordinate"]; \
|
|
307
|
+
auto mapViewEventEmitter = \
|
|
308
|
+
std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter); \
|
|
309
|
+
facebook::react::RNMapsMapViewEventEmitter::eventName data = { \
|
|
310
|
+
.coordinate.latitude = [coordinateDict[@"latitude"] doubleValue], \
|
|
311
|
+
.coordinate.longitude = [coordinateDict[@"longitude"] doubleValue], \
|
|
312
|
+
.id = std::string([[dictionary valueForKey:@"id"] UTF8String]), \
|
|
313
|
+
}; \
|
|
314
|
+
mapViewEventEmitter->emitterFunction(data); \
|
|
315
|
+
}
|
|
345
316
|
|
|
346
317
|
|
|
347
|
-
}
|
|
348
318
|
|
|
349
|
-
|
|
319
|
+
#define HANDLE_MARKER_EVENT(eventName, emitterFunction, actionName) \
|
|
320
|
+
if (_eventEmitter) { \
|
|
321
|
+
NSDictionary* coordinateDict = dictionary[@"coordinate"]; \
|
|
322
|
+
facebook::react::RNMapsMapViewEventEmitter::eventName##Coordinate coordinate = { \
|
|
323
|
+
.latitude = [coordinateDict[@"latitude"] doubleValue], \
|
|
324
|
+
.longitude = [coordinateDict[@"longitude"] doubleValue], \
|
|
325
|
+
}; \
|
|
326
|
+
\
|
|
327
|
+
auto mapViewEventEmitter = \
|
|
328
|
+
std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter); \
|
|
329
|
+
facebook::react::RNMapsMapViewEventEmitter::eventName data = { \
|
|
330
|
+
.action = std::string([@actionName UTF8String]), \
|
|
331
|
+
.id = std::string([[dictionary valueForKey:@"id"] UTF8String]), \
|
|
332
|
+
.coordinate = coordinate \
|
|
333
|
+
}; \
|
|
334
|
+
mapViewEventEmitter->emitterFunction(data); \
|
|
350
335
|
}
|
|
351
336
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
337
|
+
_view.onMarkerDrag = [self](NSDictionary* dictionary) {
|
|
338
|
+
HANDLE_MARKER_DRAG_EVENT(OnMarkerDrag, onMarkerDrag);
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
_view.onMarkerDragStart = [self](NSDictionary* dictionary) {
|
|
342
|
+
HANDLE_MARKER_DRAG_EVENT(OnMarkerDragStart, onMarkerDragStart);
|
|
343
|
+
};
|
|
344
|
+
|
|
345
|
+
_view.onMarkerDragEnd = [self](NSDictionary* dictionary) {
|
|
346
|
+
HANDLE_MARKER_DRAG_EVENT(OnMarkerDragEnd, onMarkerDragEnd);
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
_view.onMarkerSelect = [self](NSDictionary* dictionary) {
|
|
350
|
+
HANDLE_MARKER_EVENT(OnMarkerSelect, onMarkerSelect, "marker-select");
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
_view.onMarkerDeselect = [self](NSDictionary* dictionary) {
|
|
354
|
+
HANDLE_MARKER_EVENT(OnMarkerDeselect, onMarkerDeselect, "marker-deselect");
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
_view.onMarkerPress = [self](NSDictionary* dictionary) {
|
|
358
|
+
HANDLE_MARKER_EVENT(OnMarkerPress, onMarkerPress, "marker-press");
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
- (instancetype)initWithFrame:(CGRect)frame
|
|
362
|
+
{
|
|
363
|
+
if (self = [super initWithFrame:frame]) {
|
|
364
|
+
[self prepareMapView];
|
|
357
365
|
}
|
|
358
|
-
|
|
359
|
-
return
|
|
366
|
+
|
|
367
|
+
return self;
|
|
360
368
|
}
|
|
361
369
|
|
|
370
|
+
|
|
362
371
|
- (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index{
|
|
363
|
-
id<RCTComponent> paperView = [
|
|
372
|
+
id<RCTComponent> paperView = [childComponentView getPaperViewFromChildComponentView];
|
|
364
373
|
if (paperView){
|
|
365
374
|
[_view insertReactSubview:paperView atIndex:index];
|
|
375
|
+
} else if ([childComponentView isKindOfClass:[RNMapsMarkerView class]]){
|
|
376
|
+
RNMapsMarkerView* fabricMarker = (RNMapsMarkerView *) childComponentView;
|
|
377
|
+
[_view insertReactSubview:[fabricMarker marker] atIndex:index];
|
|
378
|
+
}
|
|
379
|
+
else {
|
|
380
|
+
[_view insertReactSubview:childComponentView atIndex:index];
|
|
366
381
|
}
|
|
367
382
|
}
|
|
383
|
+
|
|
368
384
|
- (void) unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
|
|
369
385
|
{
|
|
370
|
-
id<RCTComponent> paperView = [
|
|
386
|
+
id<RCTComponent> paperView = [childComponentView getPaperViewFromChildComponentView];
|
|
371
387
|
if (paperView){
|
|
372
388
|
[_view removeReactSubview:paperView];
|
|
373
389
|
}
|
|
390
|
+
else if ([childComponentView isKindOfClass:[RNMapsMarkerView class]]){
|
|
391
|
+
RNMapsMarkerView* fabricMarker = (RNMapsMarkerView *) childComponentView;
|
|
392
|
+
[_view removeReactSubview:[fabricMarker marker]];
|
|
393
|
+
} else {
|
|
394
|
+
[_view removeReactSubview:childComponentView];
|
|
395
|
+
}
|
|
374
396
|
}
|
|
375
397
|
|
|
376
398
|
MKMapType mapRNTypeToMKMapType(RNMapsMapViewMapType rnMapType) {
|
|
@@ -388,67 +410,76 @@ MKMapType mapRNTypeToMKMapType(RNMapsMapViewMapType rnMapType) {
|
|
|
388
410
|
|
|
389
411
|
- (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
|
|
390
412
|
{
|
|
391
|
-
|
|
392
|
-
|
|
413
|
+
[self prepareMapView];
|
|
414
|
+
const auto &oldViewProps = *std::static_pointer_cast<RNMapsMapViewProps const>(_props);
|
|
415
|
+
const auto &newViewProps = *std::static_pointer_cast<RNMapsMapViewProps const>(props);
|
|
393
416
|
|
|
394
417
|
#define REMAP_MAPVIEW_PROP(name) \
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
418
|
+
if (oldViewProps.name != newViewProps.name) { \
|
|
419
|
+
_view.name = newViewProps.name; \
|
|
420
|
+
}
|
|
398
421
|
|
|
399
422
|
#define REMAP_MAPVIEW_STRING_PROP(name) \
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
423
|
+
if (oldViewProps.name != newViewProps.name) { \
|
|
424
|
+
_view.name = RCTNSStringFromString(newViewProps.name); \
|
|
425
|
+
}
|
|
403
426
|
|
|
404
427
|
#define REMAP_MAPVIEW_COLOR_PROP(name) \
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
428
|
+
if (oldViewProps.name != newViewProps.name) { \
|
|
429
|
+
_view.name = RCTUIColorFromSharedColor(newViewProps.name); \
|
|
430
|
+
}
|
|
408
431
|
|
|
409
432
|
#define REMAP_MAPVIEW_POINT_PROP(name) \
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
433
|
+
if (newViewProps.name.x != oldViewProps.name.x || \
|
|
434
|
+
newViewProps.name.y != oldViewProps.name.y) { \
|
|
435
|
+
_view.name = CGPointMake(newViewProps.name.x, newViewProps.name.y); \
|
|
436
|
+
}
|
|
414
437
|
|
|
415
438
|
#define REMAP_MAPVIEW_REGION_PROP(name) \
|
|
416
|
-
|
|
417
|
-
|
|
439
|
+
if (!(newViewProps.name.latitude == 0 && \
|
|
440
|
+
newViewProps.name.longitude == 0 && \
|
|
441
|
+
newViewProps.name.latitudeDelta == 0 && \
|
|
442
|
+
newViewProps.name.longitudeDelta == 0)) { \
|
|
443
|
+
if (newViewProps.name.latitude != oldViewProps.name.latitude || \
|
|
444
|
+
newViewProps.name.longitude != oldViewProps.name.longitude || \
|
|
418
445
|
newViewProps.name.latitudeDelta != oldViewProps.name.latitudeDelta ||\
|
|
419
446
|
newViewProps.name.longitudeDelta != oldViewProps.name.longitudeDelta) { \
|
|
420
447
|
MKCoordinateSpan span = MKCoordinateSpanMake(newViewProps.name.latitudeDelta, \
|
|
421
448
|
newViewProps.name.longitudeDelta); \
|
|
422
449
|
MKCoordinateRegion region = MKCoordinateRegionMake(CLLocationCoordinate2DMake( \
|
|
423
|
-
|
|
450
|
+
newViewProps.name.latitude, \
|
|
451
|
+
newViewProps.name.longitude), span); \
|
|
424
452
|
_view.name = region; \
|
|
425
|
-
}
|
|
453
|
+
} \
|
|
454
|
+
}
|
|
455
|
+
|
|
426
456
|
|
|
427
457
|
#define REMAP_MAPVIEW_CAMERA_PROP(name) \
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
458
|
+
if (newViewProps.name.center.latitude != oldViewProps.name.center.latitude || \
|
|
459
|
+
newViewProps.name.center.longitude != oldViewProps.name.center.longitude || \
|
|
460
|
+
newViewProps.name.heading != oldViewProps.name.heading || \
|
|
461
|
+
newViewProps.name.pitch != oldViewProps.name.pitch) { \
|
|
462
|
+
CLLocationCoordinate2D center = CLLocationCoordinate2DMake( \
|
|
463
|
+
newViewProps.name.center.latitude, \
|
|
464
|
+
newViewProps.name.center.longitude); \
|
|
465
|
+
MKMapCamera* camera = [[MKMapCamera alloc] init]; \
|
|
466
|
+
camera.centerCoordinate = center; \
|
|
467
|
+
camera.heading = newViewProps.name.heading; \
|
|
468
|
+
camera.pitch = newViewProps.name.pitch; \
|
|
469
|
+
camera.centerCoordinateDistance = newViewProps.name.altitude; \
|
|
470
|
+
_view.name = camera; \
|
|
471
|
+
}
|
|
441
472
|
|
|
442
473
|
#define REMAP_MAPVIEW_EDGEINSETS_PROP(name) \
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
474
|
+
if (newViewProps.name.top != oldViewProps.name.top || \
|
|
475
|
+
newViewProps.name.right != oldViewProps.name.right || \
|
|
476
|
+
newViewProps.name.bottom != oldViewProps.name.bottom || \
|
|
477
|
+
newViewProps.name.left != oldViewProps.name.left) { \
|
|
478
|
+
_view.name = UIEdgeInsetsMake(newViewProps.name.top, \
|
|
479
|
+
newViewProps.name.left, \
|
|
480
|
+
newViewProps.name.bottom, \
|
|
481
|
+
newViewProps.name.right); \
|
|
482
|
+
}
|
|
452
483
|
|
|
453
484
|
#define REMAP_MAPVIEW_MAPTYPE(rnMapType) MKMapType##rnMapType
|
|
454
485
|
|
|
@@ -457,7 +488,9 @@ MKMapType mapRNTypeToMKMapType(RNMapsMapViewMapType rnMapType) {
|
|
|
457
488
|
|
|
458
489
|
REMAP_MAPVIEW_PROP(followsUserLocation)
|
|
459
490
|
REMAP_MAPVIEW_PROP(loadingEnabled)
|
|
491
|
+
|
|
460
492
|
REMAP_MAPVIEW_PROP(scrollEnabled)
|
|
493
|
+
REMAP_MAPVIEW_PROP(handlePanDrag)
|
|
461
494
|
|
|
462
495
|
REMAP_MAPVIEW_PROP(maxDelta)
|
|
463
496
|
REMAP_MAPVIEW_PROP(maxZoom)
|
|
@@ -466,15 +499,19 @@ MKMapType mapRNTypeToMKMapType(RNMapsMapViewMapType rnMapType) {
|
|
|
466
499
|
|
|
467
500
|
REMAP_MAPVIEW_PROP(showsCompass)
|
|
468
501
|
REMAP_MAPVIEW_PROP(showsScale)
|
|
469
|
-
REMAP_MAPVIEW_PROP(showsTraffic)
|
|
470
502
|
REMAP_MAPVIEW_PROP(showsUserLocation)
|
|
471
503
|
REMAP_MAPVIEW_PROP(userLocationCalloutEnabled)
|
|
472
504
|
REMAP_MAPVIEW_PROP(zoomEnabled)
|
|
473
505
|
|
|
506
|
+
|
|
474
507
|
REMAP_MAPVIEW_POINT_PROP(compassOffset)
|
|
475
508
|
|
|
476
|
-
|
|
477
|
-
|
|
509
|
+
if (![_view ignoreRegionChanges]){
|
|
510
|
+
_view.ignoreRegionChanges = YES;
|
|
511
|
+
REMAP_MAPVIEW_REGION_PROP(initialRegion)
|
|
512
|
+
REMAP_MAPVIEW_REGION_PROP(region)
|
|
513
|
+
_view.ignoreRegionChanges = NO;
|
|
514
|
+
}
|
|
478
515
|
|
|
479
516
|
REMAP_MAPVIEW_CAMERA_PROP(initialCamera)
|
|
480
517
|
REMAP_MAPVIEW_CAMERA_PROP(camera)
|
|
@@ -514,12 +551,12 @@ MKMapType mapRNTypeToMKMapType(RNMapsMapViewMapType rnMapType) {
|
|
|
514
551
|
}
|
|
515
552
|
|
|
516
553
|
|
|
517
|
-
|
|
554
|
+
[super updateProps:props oldProps:oldProps];
|
|
518
555
|
}
|
|
519
556
|
|
|
520
557
|
@end
|
|
521
558
|
|
|
522
559
|
Class<RCTComponentViewProtocol> RNMapsMapViewCls(void)
|
|
523
560
|
{
|
|
524
|
-
|
|
561
|
+
return RNMapsMapView.class;
|
|
525
562
|
}
|