react-native-maps 1.21.0-alpha.6 → 1.21.0-alpha.60
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 +32 -8
- package/android/generated/java/com/facebook/fbreact/specs/NativeAirMapsModuleSpec.java +63 -0
- package/android/generated/java/com/facebook/react/viewmanagers/RNMapsMapViewManagerDelegate.java +199 -0
- package/android/generated/java/com/facebook/react/viewmanagers/RNMapsMapViewManagerInterface.java +71 -0
- package/android/generated/java/com/facebook/react/viewmanagers/RNMapsMarkerManagerDelegate.java +103 -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 +25 -0
- package/android/generated/jni/react/renderer/components/RNMapsSpecs/ComponentDescriptors.h +27 -0
- package/android/generated/jni/react/renderer/components/RNMapsSpecs/EventEmitters.cpp +896 -0
- package/android/generated/jni/react/renderer/components/RNMapsSpecs/EventEmitters.h +765 -0
- package/android/generated/jni/react/renderer/components/RNMapsSpecs/Props.cpp +146 -0
- package/android/generated/jni/react/renderer/components/RNMapsSpecs/Props.h +1047 -0
- package/android/generated/jni/react/renderer/components/RNMapsSpecs/RNMapsSpecsJSI-generated.cpp +74 -0
- package/android/generated/jni/react/renderer/components/RNMapsSpecs/RNMapsSpecsJSI.h +264 -0
- package/android/generated/jni/react/renderer/components/RNMapsSpecs/ShadowNodes.cpp +20 -0
- package/android/generated/jni/react/renderer/components/RNMapsSpecs/ShadowNodes.h +65 -0
- package/android/generated/jni/react/renderer/components/RNMapsSpecs/States.cpp +16 -0
- package/android/generated/jni/react/renderer/components/RNMapsSpecs/States.h +65 -0
- package/android/src/main/java/com/rnmaps/fabric/JSONUtil.java +86 -0
- package/android/src/main/java/com/rnmaps/fabric/MapViewManager.java +577 -0
- package/android/src/main/java/com/rnmaps/fabric/MarkerManager.java +176 -0
- package/android/src/main/java/com/rnmaps/fabric/NativeAirMapsModule.java +25 -2
- 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/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/OnRegionChangeEvent.java +48 -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 +18 -2
- package/android/src/main/java/com/rnmaps/maps/MapManager.java +14 -14
- package/android/src/main/java/com/rnmaps/maps/MapMarker.java +53 -1
- package/android/src/main/java/com/rnmaps/maps/MapView.java +1613 -1346
- package/ios/AirGoogleMaps/AIRGoogleMap.h +8 -2
- package/ios/AirGoogleMaps/AIRGoogleMap.m +243 -55
- package/ios/AirGoogleMaps/AIRGoogleMapCircle.h +0 -1
- package/ios/AirGoogleMaps/AIRGoogleMapCircle.m +23 -11
- package/ios/AirGoogleMaps/AIRGoogleMapCoordinate.h +13 -0
- package/ios/AirGoogleMaps/AIRGoogleMapCoordinate.m +10 -0
- package/ios/AirGoogleMaps/AIRGoogleMapManager.h +7 -0
- package/ios/AirGoogleMaps/AIRGoogleMapManager.m +30 -119
- package/ios/AirGoogleMaps/AIRGoogleMapMarker.h +2 -0
- package/ios/AirGoogleMaps/AIRGoogleMapMarker.m +347 -243
- package/ios/AirGoogleMaps/AIRGoogleMapMarkerManager.m +0 -1
- package/ios/AirGoogleMaps/AIRGoogleMapOverlay.h +0 -1
- package/ios/AirGoogleMaps/AIRGoogleMapPolygon.h +5 -4
- package/ios/AirGoogleMaps/AIRGoogleMapPolygon.m +32 -2
- package/ios/AirGoogleMaps/AIRGoogleMapPolygonManager.m +3 -3
- package/ios/AirGoogleMaps/AIRGoogleMapPolyline.h +3 -2
- package/ios/AirGoogleMaps/AIRGoogleMapPolyline.m +2 -3
- package/ios/AirGoogleMaps/AIRGoogleMapPolylineManager.m +2 -2
- 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 +18 -0
- package/ios/AirGoogleMaps/RNMapsGoogleMapView.h +26 -0
- package/ios/AirGoogleMaps/RNMapsGoogleMapView.mm +629 -0
- package/ios/AirGoogleMaps/RNMapsGoogleMapViewManager.mm +25 -0
- 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 +8 -5
- package/ios/AirMaps/AIRMap.m +292 -141
- package/ios/AirMaps/AIRMapManager.m +12 -21
- 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 +4 -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 +6 -3
- package/ios/AirMaps/RNMapsMapView.mm +346 -332
- 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/RNMapsSpecs/ComponentDescriptors.cpp +25 -0
- package/ios/generated/RNMapsSpecs/ComponentDescriptors.h +27 -0
- package/ios/generated/RNMapsSpecs/EventEmitters.cpp +896 -0
- package/ios/generated/RNMapsSpecs/EventEmitters.h +765 -0
- package/ios/generated/RNMapsSpecs/Props.cpp +146 -0
- package/ios/generated/RNMapsSpecs/Props.h +1047 -0
- package/ios/generated/RNMapsSpecs/RCTComponentViewHelpers.h +549 -0
- package/ios/generated/RNMapsSpecs/RNMapsSpecs-generated.mm +92 -0
- package/ios/generated/RNMapsSpecs/RNMapsSpecs.h +134 -0
- package/ios/generated/RNMapsSpecs/ShadowNodes.cpp +20 -0
- package/ios/generated/RNMapsSpecs/ShadowNodes.h +65 -0
- package/ios/generated/RNMapsSpecs/States.cpp +16 -0
- package/ios/generated/RNMapsSpecs/States.h +65 -0
- package/ios/generated/RNMapsSpecsJSI-generated.cpp +74 -0
- package/ios/generated/RNMapsSpecsJSI.h +264 -0
- package/lib/MapMarker.d.ts +15 -2
- package/lib/MapMarker.js +53 -9
- package/lib/MapMarkerNativeComponent.js +0 -2
- package/lib/MapOverlay.d.ts +1 -1
- package/lib/MapOverlay.js +2 -8
- package/lib/MapView.d.ts +5 -22
- package/lib/MapView.js +61 -80
- package/lib/{FabricMapView.d.ts → createFabricMap.d.ts} +7 -6
- package/lib/createFabricMap.js +175 -0
- package/lib/decorateMapComponent.js +17 -0
- package/lib/specs/NativeAirMapsModule.d.ts +2 -2
- package/lib/specs/NativeComponentGoogleMapView.d.ts +713 -0
- package/lib/specs/NativeComponentGoogleMapView.js +21 -0
- package/lib/specs/NativeComponentGooglePolygon.d.ts +75 -0
- package/lib/specs/NativeComponentGooglePolygon.js +9 -0
- package/lib/specs/NativeComponentMapView.d.ts +21 -45
- 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 +13 -7
- package/react-native-maps.podspec +2 -1
- package/lib/FabricMapView.js +0 -175
|
@@ -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,310 +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
|
-
std::string action;
|
|
260
|
-
OnCalloutPressFrame frame;
|
|
261
|
-
std::string id;
|
|
262
|
-
OnCalloutPressPoint point;
|
|
263
|
-
OnCalloutPressCoordinate coordinate;
|
|
264
|
-
OnCalloutPressPosition position;
|
|
265
|
-
id event = @{
|
|
266
|
-
@"action": calloutSubview ? @"callout-inside-press" : @"callout-press",
|
|
267
|
-
@"id": marker.identifier ?: @"unknown",
|
|
268
|
-
@"point": @{
|
|
269
|
-
@"x": @(touchPointReal.x),
|
|
270
|
-
@"y": @(touchPointReal.y),
|
|
271
|
-
},
|
|
272
|
-
@"frame": @{
|
|
273
|
-
@"x": @(bubbleFrame.origin.x),
|
|
274
|
-
@"y": @(bubbleFrame.origin.y),
|
|
275
|
-
@"width": @(bubbleFrame.size.width),
|
|
276
|
-
@"height": @(bubbleFrame.size.height),
|
|
277
|
-
}
|
|
278
|
-
};
|
|
279
|
-
*/
|
|
280
|
-
|
|
281
|
-
auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
|
|
282
|
-
facebook::react::RNMapsMapViewEventEmitter::OnCalloutPress data = {
|
|
283
|
-
.action = std::string([dictionary[@"action"] UTF8String]),
|
|
284
|
-
.id = std::string([dictionary[@"id"] UTF8String]),
|
|
285
|
-
.point = point,
|
|
286
|
-
.frame = frame,
|
|
287
|
-
};
|
|
288
|
-
mapViewEventEmitter->onCalloutPress(data);
|
|
289
|
-
}
|
|
290
|
-
};
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
_view.onRegionChangeStart = [self](NSDictionary* dictionary) {
|
|
294
|
-
if (_eventEmitter) {
|
|
295
|
-
|
|
296
|
-
NSDictionary* regionDict = dictionary[@"region"];
|
|
297
|
-
auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
|
|
298
|
-
facebook::react::RNMapsMapViewEventEmitter::OnRegionChangeStart data = {
|
|
299
|
-
.region.latitude = [regionDict[@"latitude"] doubleValue],
|
|
300
|
-
.region.longitude = [regionDict[@"longitude"] doubleValue],
|
|
301
|
-
.region.latitudeDelta = [regionDict[@"latitudeDelta"] doubleValue],
|
|
302
|
-
.region.longitudeDelta = [regionDict[@"longitudeDelta"] doubleValue],
|
|
303
|
-
.continuous = [dictionary[@"continuous"] boolValue],
|
|
304
|
-
};
|
|
305
|
-
mapViewEventEmitter->onRegionChangeStart(data);
|
|
306
|
-
}
|
|
307
|
-
};
|
|
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
|
+
};
|
|
308
145
|
|
|
309
146
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
NSDictionary* coordinateDict = dictionary[@"coordinate"]; \
|
|
313
|
-
auto mapViewEventEmitter = \
|
|
314
|
-
std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter); \
|
|
315
|
-
facebook::react::RNMapsMapViewEventEmitter::eventName data = { \
|
|
316
|
-
.coordinate.latitude = [coordinateDict[@"latitude"] doubleValue], \
|
|
317
|
-
.coordinate.longitude = [coordinateDict[@"longitude"] doubleValue], \
|
|
318
|
-
.id = std::string([[dictionary valueForKey:@"id"] UTF8String]), \
|
|
319
|
-
}; \
|
|
320
|
-
mapViewEventEmitter->emitterFunction(data); \
|
|
321
|
-
}
|
|
147
|
+
_view.onMapReady = [self](NSDictionary* dictionary) {
|
|
148
|
+
if (_eventEmitter) {
|
|
322
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
|
+
};
|
|
323
223
|
|
|
224
|
+
_view.onUserLocationChange = [self](NSDictionary* dictionary) {
|
|
225
|
+
if (_eventEmitter) {
|
|
324
226
|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
NSDictionary* coordinateDict = dictionary[@"coordinate"]; \
|
|
328
|
-
facebook::react::RNMapsMapViewEventEmitter::eventName##Coordinate coordinate = { \
|
|
329
|
-
.latitude = [coordinateDict[@"latitude"] doubleValue], \
|
|
330
|
-
.longitude = [coordinateDict[@"longitude"] doubleValue], \
|
|
331
|
-
}; \
|
|
332
|
-
\
|
|
333
|
-
auto mapViewEventEmitter = \
|
|
334
|
-
std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter); \
|
|
335
|
-
facebook::react::RNMapsMapViewEventEmitter::eventName data = { \
|
|
336
|
-
.action = std::string([@actionName UTF8String]), \
|
|
337
|
-
.id = std::string([[dictionary valueForKey:@"id"] UTF8String]), \
|
|
338
|
-
.coordinate = coordinate \
|
|
339
|
-
}; \
|
|
340
|
-
mapViewEventEmitter->emitterFunction(data); \
|
|
341
|
-
}
|
|
227
|
+
NSDictionary* coordinateDict = dictionary[@"coordinate"];
|
|
228
|
+
NSDictionary* errorDict = dictionary[@"error"];
|
|
342
229
|
|
|
343
|
-
_view.onMarkerDrag = [self](NSDictionary* dictionary) {
|
|
344
|
-
HANDLE_MARKER_DRAG_EVENT(OnMarkerDrag, onMarkerDrag);
|
|
345
|
-
};
|
|
346
230
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
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
|
+
}
|
|
350
240
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
241
|
+
facebook::react::RNMapsMapViewEventEmitter::OnUserLocationChangeError error = {
|
|
242
|
+
.message = std::string([str UTF8String]),
|
|
243
|
+
};
|
|
354
244
|
|
|
355
|
-
_view.onMarkerSelect = [self](NSDictionary* dictionary) {
|
|
356
|
-
HANDLE_MARKER_EVENT(OnMarkerSelect, onMarkerSelect, "marker-select");
|
|
357
|
-
};
|
|
358
245
|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
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
|
+
};
|
|
362
302
|
|
|
363
|
-
_view.onMarkerPress = [self](NSDictionary* dictionary) {
|
|
364
|
-
HANDLE_MARKER_EVENT(OnMarkerPress, onMarkerPress, "marker-press");
|
|
365
|
-
};
|
|
366
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
|
+
}
|
|
367
316
|
|
|
368
317
|
|
|
369
|
-
}
|
|
370
318
|
|
|
371
|
-
|
|
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); \
|
|
372
335
|
}
|
|
373
336
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
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];
|
|
379
365
|
}
|
|
380
|
-
|
|
381
|
-
return
|
|
366
|
+
|
|
367
|
+
return self;
|
|
382
368
|
}
|
|
383
369
|
|
|
370
|
+
|
|
384
371
|
- (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index{
|
|
385
|
-
id<RCTComponent> paperView = [
|
|
372
|
+
id<RCTComponent> paperView = [childComponentView getPaperViewFromChildComponentView];
|
|
386
373
|
if (paperView){
|
|
387
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];
|
|
388
381
|
}
|
|
389
382
|
}
|
|
383
|
+
|
|
390
384
|
- (void) unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
|
|
391
385
|
{
|
|
392
|
-
id<RCTComponent> paperView = [
|
|
386
|
+
id<RCTComponent> paperView = [childComponentView getPaperViewFromChildComponentView];
|
|
393
387
|
if (paperView){
|
|
394
388
|
[_view removeReactSubview:paperView];
|
|
395
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
|
+
}
|
|
396
396
|
}
|
|
397
397
|
|
|
398
398
|
MKMapType mapRNTypeToMKMapType(RNMapsMapViewMapType rnMapType) {
|
|
@@ -410,67 +410,76 @@ MKMapType mapRNTypeToMKMapType(RNMapsMapViewMapType rnMapType) {
|
|
|
410
410
|
|
|
411
411
|
- (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
|
|
412
412
|
{
|
|
413
|
-
|
|
414
|
-
|
|
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);
|
|
415
416
|
|
|
416
417
|
#define REMAP_MAPVIEW_PROP(name) \
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
418
|
+
if (oldViewProps.name != newViewProps.name) { \
|
|
419
|
+
_view.name = newViewProps.name; \
|
|
420
|
+
}
|
|
420
421
|
|
|
421
422
|
#define REMAP_MAPVIEW_STRING_PROP(name) \
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
423
|
+
if (oldViewProps.name != newViewProps.name) { \
|
|
424
|
+
_view.name = RCTNSStringFromString(newViewProps.name); \
|
|
425
|
+
}
|
|
425
426
|
|
|
426
427
|
#define REMAP_MAPVIEW_COLOR_PROP(name) \
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
428
|
+
if (oldViewProps.name != newViewProps.name) { \
|
|
429
|
+
_view.name = RCTUIColorFromSharedColor(newViewProps.name); \
|
|
430
|
+
}
|
|
430
431
|
|
|
431
432
|
#define REMAP_MAPVIEW_POINT_PROP(name) \
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
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
|
+
}
|
|
436
437
|
|
|
437
438
|
#define REMAP_MAPVIEW_REGION_PROP(name) \
|
|
438
|
-
|
|
439
|
-
|
|
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 || \
|
|
440
445
|
newViewProps.name.latitudeDelta != oldViewProps.name.latitudeDelta ||\
|
|
441
446
|
newViewProps.name.longitudeDelta != oldViewProps.name.longitudeDelta) { \
|
|
442
447
|
MKCoordinateSpan span = MKCoordinateSpanMake(newViewProps.name.latitudeDelta, \
|
|
443
448
|
newViewProps.name.longitudeDelta); \
|
|
444
449
|
MKCoordinateRegion region = MKCoordinateRegionMake(CLLocationCoordinate2DMake( \
|
|
445
|
-
|
|
450
|
+
newViewProps.name.latitude, \
|
|
451
|
+
newViewProps.name.longitude), span); \
|
|
446
452
|
_view.name = region; \
|
|
447
|
-
}
|
|
453
|
+
} \
|
|
454
|
+
}
|
|
455
|
+
|
|
448
456
|
|
|
449
457
|
#define REMAP_MAPVIEW_CAMERA_PROP(name) \
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
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
|
+
}
|
|
463
472
|
|
|
464
473
|
#define REMAP_MAPVIEW_EDGEINSETS_PROP(name) \
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
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
|
+
}
|
|
474
483
|
|
|
475
484
|
#define REMAP_MAPVIEW_MAPTYPE(rnMapType) MKMapType##rnMapType
|
|
476
485
|
|
|
@@ -479,24 +488,30 @@ MKMapType mapRNTypeToMKMapType(RNMapsMapViewMapType rnMapType) {
|
|
|
479
488
|
|
|
480
489
|
REMAP_MAPVIEW_PROP(followsUserLocation)
|
|
481
490
|
REMAP_MAPVIEW_PROP(loadingEnabled)
|
|
491
|
+
|
|
482
492
|
REMAP_MAPVIEW_PROP(scrollEnabled)
|
|
493
|
+
REMAP_MAPVIEW_PROP(handlePanDrag)
|
|
483
494
|
|
|
484
495
|
REMAP_MAPVIEW_PROP(maxDelta)
|
|
485
|
-
REMAP_MAPVIEW_PROP(
|
|
496
|
+
REMAP_MAPVIEW_PROP(maxZoom)
|
|
486
497
|
REMAP_MAPVIEW_PROP(minDelta)
|
|
487
|
-
REMAP_MAPVIEW_PROP(
|
|
498
|
+
REMAP_MAPVIEW_PROP(minZoom)
|
|
488
499
|
|
|
489
500
|
REMAP_MAPVIEW_PROP(showsCompass)
|
|
490
501
|
REMAP_MAPVIEW_PROP(showsScale)
|
|
491
|
-
REMAP_MAPVIEW_PROP(showsTraffic)
|
|
492
502
|
REMAP_MAPVIEW_PROP(showsUserLocation)
|
|
493
503
|
REMAP_MAPVIEW_PROP(userLocationCalloutEnabled)
|
|
494
504
|
REMAP_MAPVIEW_PROP(zoomEnabled)
|
|
495
505
|
|
|
506
|
+
|
|
496
507
|
REMAP_MAPVIEW_POINT_PROP(compassOffset)
|
|
497
508
|
|
|
498
|
-
|
|
499
|
-
|
|
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
|
+
}
|
|
500
515
|
|
|
501
516
|
REMAP_MAPVIEW_CAMERA_PROP(initialCamera)
|
|
502
517
|
REMAP_MAPVIEW_CAMERA_PROP(camera)
|
|
@@ -508,7 +523,6 @@ MKMapType mapRNTypeToMKMapType(RNMapsMapViewMapType rnMapType) {
|
|
|
508
523
|
REMAP_MAPVIEW_COLOR_PROP(loadingIndicatorColor)
|
|
509
524
|
REMAP_MAPVIEW_COLOR_PROP(tintColor)
|
|
510
525
|
|
|
511
|
-
// userLocationAnnotationTitle
|
|
512
526
|
REMAP_MAPVIEW_STRING_PROP(userLocationAnnotationTitle)
|
|
513
527
|
|
|
514
528
|
if (oldViewProps.mapType != newViewProps.mapType){
|
|
@@ -537,12 +551,12 @@ MKMapType mapRNTypeToMKMapType(RNMapsMapViewMapType rnMapType) {
|
|
|
537
551
|
}
|
|
538
552
|
|
|
539
553
|
|
|
540
|
-
|
|
554
|
+
[super updateProps:props oldProps:oldProps];
|
|
541
555
|
}
|
|
542
556
|
|
|
543
557
|
@end
|
|
544
558
|
|
|
545
559
|
Class<RCTComponentViewProtocol> RNMapsMapViewCls(void)
|
|
546
560
|
{
|
|
547
|
-
|
|
561
|
+
return RNMapsMapView.class;
|
|
548
562
|
}
|