react-native-maps 1.21.0-alpha.4 → 1.21.0-alpha.40
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/src/main/java/com/rnmaps/fabric/NativeAirMapsModule.java +51 -0
- package/android/src/main/java/com/rnmaps/maps/MapAirModulePackage.java +46 -0
- package/ios/AirGoogleMaps/AIRGoogleMap.h +8 -2
- package/ios/AirGoogleMaps/AIRGoogleMap.m +179 -11
- 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 +599 -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 +284 -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 +3 -0
- 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 +341 -334
- package/ios/AirMaps/RNMapsMarkerView.h +24 -0
- package/ios/AirMaps/RNMapsMarkerView.mm +422 -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/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/MapView.d.ts +5 -22
- package/lib/MapView.js +34 -21
- package/lib/{FabricMapView.d.ts → createFabricMap.d.ts} +7 -6
- package/lib/createFabricMap.js +175 -0
- package/lib/decorateMapComponent.js +18 -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/NativeComponentMarker.d.ts +258 -0
- package/lib/specs/NativeComponentMarker.js +21 -0
- package/package.json +7 -7
- package/react-native-maps.podspec +1 -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 "RNMapsMarkerView.h"
|
|
13
14
|
#import <react/renderer/components/RNMapsSpecs/ComponentDescriptors.h>
|
|
14
15
|
#import <react/renderer/components/RNMapsSpecs/EventEmitters.h>
|
|
15
16
|
#import <react/renderer/components/RNMapsSpecs/Props.h>
|
|
16
17
|
#import <react/renderer/components/RNMapsSpecs/RCTComponentViewHelpers.h>
|
|
17
|
-
|
|
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,69 @@ 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
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
439
|
+
if (newViewProps.name.latitude != oldViewProps.name.latitude || \
|
|
440
|
+
newViewProps.name.longitude != oldViewProps.name.longitude || \
|
|
441
|
+
newViewProps.name.latitudeDelta != oldViewProps.name.latitudeDelta ||\
|
|
442
|
+
newViewProps.name.longitudeDelta != oldViewProps.name.longitudeDelta) { \
|
|
443
|
+
MKCoordinateSpan span = MKCoordinateSpanMake(newViewProps.name.latitudeDelta, \
|
|
444
|
+
newViewProps.name.longitudeDelta); \
|
|
445
|
+
MKCoordinateRegion region = MKCoordinateRegionMake(CLLocationCoordinate2DMake( \
|
|
446
|
+
newViewProps.name.latitude, newViewProps.name.longitude), span); \
|
|
447
|
+
_view.name = region; \
|
|
448
|
+
}
|
|
448
449
|
|
|
449
450
|
#define REMAP_MAPVIEW_CAMERA_PROP(name) \
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
451
|
+
if (newViewProps.name.center.latitude != oldViewProps.name.center.latitude || \
|
|
452
|
+
newViewProps.name.center.longitude != oldViewProps.name.center.longitude || \
|
|
453
|
+
newViewProps.name.heading != oldViewProps.name.heading || \
|
|
454
|
+
newViewProps.name.pitch != oldViewProps.name.pitch) { \
|
|
455
|
+
CLLocationCoordinate2D center = CLLocationCoordinate2DMake( \
|
|
456
|
+
newViewProps.name.center.latitude, \
|
|
457
|
+
newViewProps.name.center.longitude); \
|
|
458
|
+
MKMapCamera* camera = [[MKMapCamera alloc] init]; \
|
|
459
|
+
camera.centerCoordinate = center; \
|
|
460
|
+
camera.heading = newViewProps.name.heading; \
|
|
461
|
+
camera.pitch = newViewProps.name.pitch; \
|
|
462
|
+
camera.centerCoordinateDistance = newViewProps.name.altitude; \
|
|
463
|
+
_view.name = camera; \
|
|
464
|
+
}
|
|
463
465
|
|
|
464
466
|
#define REMAP_MAPVIEW_EDGEINSETS_PROP(name) \
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
467
|
+
if (newViewProps.name.top != oldViewProps.name.top || \
|
|
468
|
+
newViewProps.name.right != oldViewProps.name.right || \
|
|
469
|
+
newViewProps.name.bottom != oldViewProps.name.bottom || \
|
|
470
|
+
newViewProps.name.left != oldViewProps.name.left) { \
|
|
471
|
+
_view.name = UIEdgeInsetsMake(newViewProps.name.top, \
|
|
472
|
+
newViewProps.name.left, \
|
|
473
|
+
newViewProps.name.bottom, \
|
|
474
|
+
newViewProps.name.right); \
|
|
475
|
+
}
|
|
474
476
|
|
|
475
477
|
#define REMAP_MAPVIEW_MAPTYPE(rnMapType) MKMapType##rnMapType
|
|
476
478
|
|
|
@@ -479,24 +481,30 @@ MKMapType mapRNTypeToMKMapType(RNMapsMapViewMapType rnMapType) {
|
|
|
479
481
|
|
|
480
482
|
REMAP_MAPVIEW_PROP(followsUserLocation)
|
|
481
483
|
REMAP_MAPVIEW_PROP(loadingEnabled)
|
|
484
|
+
|
|
482
485
|
REMAP_MAPVIEW_PROP(scrollEnabled)
|
|
486
|
+
REMAP_MAPVIEW_PROP(handlePanDrag)
|
|
483
487
|
|
|
484
488
|
REMAP_MAPVIEW_PROP(maxDelta)
|
|
485
|
-
REMAP_MAPVIEW_PROP(
|
|
489
|
+
REMAP_MAPVIEW_PROP(maxZoom)
|
|
486
490
|
REMAP_MAPVIEW_PROP(minDelta)
|
|
487
|
-
REMAP_MAPVIEW_PROP(
|
|
491
|
+
REMAP_MAPVIEW_PROP(minZoom)
|
|
488
492
|
|
|
489
493
|
REMAP_MAPVIEW_PROP(showsCompass)
|
|
490
494
|
REMAP_MAPVIEW_PROP(showsScale)
|
|
491
|
-
REMAP_MAPVIEW_PROP(showsTraffic)
|
|
492
495
|
REMAP_MAPVIEW_PROP(showsUserLocation)
|
|
493
496
|
REMAP_MAPVIEW_PROP(userLocationCalloutEnabled)
|
|
494
497
|
REMAP_MAPVIEW_PROP(zoomEnabled)
|
|
495
498
|
|
|
499
|
+
|
|
496
500
|
REMAP_MAPVIEW_POINT_PROP(compassOffset)
|
|
497
501
|
|
|
498
|
-
|
|
499
|
-
|
|
502
|
+
if (![_view ignoreRegionChanges]){
|
|
503
|
+
_view.ignoreRegionChanges = YES;
|
|
504
|
+
REMAP_MAPVIEW_REGION_PROP(initialRegion)
|
|
505
|
+
REMAP_MAPVIEW_REGION_PROP(region)
|
|
506
|
+
_view.ignoreRegionChanges = NO;
|
|
507
|
+
}
|
|
500
508
|
|
|
501
509
|
REMAP_MAPVIEW_CAMERA_PROP(initialCamera)
|
|
502
510
|
REMAP_MAPVIEW_CAMERA_PROP(camera)
|
|
@@ -508,7 +516,6 @@ MKMapType mapRNTypeToMKMapType(RNMapsMapViewMapType rnMapType) {
|
|
|
508
516
|
REMAP_MAPVIEW_COLOR_PROP(loadingIndicatorColor)
|
|
509
517
|
REMAP_MAPVIEW_COLOR_PROP(tintColor)
|
|
510
518
|
|
|
511
|
-
// userLocationAnnotationTitle
|
|
512
519
|
REMAP_MAPVIEW_STRING_PROP(userLocationAnnotationTitle)
|
|
513
520
|
|
|
514
521
|
if (oldViewProps.mapType != newViewProps.mapType){
|
|
@@ -537,12 +544,12 @@ MKMapType mapRNTypeToMKMapType(RNMapsMapViewMapType rnMapType) {
|
|
|
537
544
|
}
|
|
538
545
|
|
|
539
546
|
|
|
540
|
-
|
|
547
|
+
[super updateProps:props oldProps:oldProps];
|
|
541
548
|
}
|
|
542
549
|
|
|
543
550
|
@end
|
|
544
551
|
|
|
545
552
|
Class<RCTComponentViewProtocol> RNMapsMapViewCls(void)
|
|
546
553
|
{
|
|
547
|
-
|
|
554
|
+
return RNMapsMapView.class;
|
|
548
555
|
}
|