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
|
@@ -19,14 +19,9 @@
|
|
|
19
19
|
#import <React/UIView+React.h>
|
|
20
20
|
#import "RCTConvert+GMSMapViewType.h"
|
|
21
21
|
#import "AIRGoogleMap.h"
|
|
22
|
-
#import "AIRMapMarker.h"
|
|
23
|
-
#import "AIRMapPolyline.h"
|
|
24
|
-
#import "AIRMapPolygon.h"
|
|
25
|
-
#import "AIRMapCircle.h"
|
|
26
|
-
#import "SMCalloutView.h"
|
|
27
22
|
#import "AIRGoogleMapMarker.h"
|
|
28
|
-
#import "
|
|
29
|
-
|
|
23
|
+
#import "AIRGoogleMapCoordinate.h"
|
|
24
|
+
#import "RCTConvert+GMSMapViewType.h"
|
|
30
25
|
#import <MapKit/MapKit.h>
|
|
31
26
|
#import <QuartzCore/QuartzCore.h>
|
|
32
27
|
|
|
@@ -45,26 +40,22 @@ RCT_EXPORT_MODULE()
|
|
|
45
40
|
|
|
46
41
|
- (UIView *)view
|
|
47
42
|
{
|
|
48
|
-
NSString* googleMapId = nil;
|
|
49
|
-
BOOL zoomTapEnabled = YES;
|
|
50
|
-
UIColor* backgroundColor = nil;
|
|
51
|
-
GMSCameraPosition* camera = nil;
|
|
52
43
|
|
|
53
44
|
if (self.initialProps){
|
|
54
45
|
if (self.initialProps[@"googleMapId"]){
|
|
55
|
-
|
|
46
|
+
_googleMapId = self.initialProps[@"googleMapId"];
|
|
56
47
|
}
|
|
57
48
|
if (self.initialProps[@"zoomTapEnabled"]){
|
|
58
|
-
|
|
49
|
+
_zoomTapEnabled = self.initialProps[@"zoomTapEnabled"];
|
|
59
50
|
}
|
|
60
51
|
if (self.initialProps[@"loadingBackgroundColor"]){
|
|
61
|
-
|
|
52
|
+
_backgroundColor = [RCTConvert UIColor:self.initialProps[@"loadingBackgroundColor"]];
|
|
62
53
|
}
|
|
63
54
|
if (self.initialProps[@"initialCamera"]){
|
|
64
|
-
|
|
55
|
+
_camera = [RCTConvert GMSCameraPositionWithDefaults:self.initialProps[@"initialCamera"] existingCamera:nil];
|
|
65
56
|
}
|
|
66
57
|
}
|
|
67
|
-
AIRGoogleMap *map = [[AIRGoogleMap alloc] initWithMapId:googleMapId initialCamera:camera backgroundColor:backgroundColor andZoomTapEnabled:zoomTapEnabled];
|
|
58
|
+
AIRGoogleMap *map = [[AIRGoogleMap alloc] initWithMapId:self.googleMapId initialCamera:self.camera backgroundColor:self.backgroundColor andZoomTapEnabled:self.zoomTapEnabled];
|
|
68
59
|
map.bridge = self.bridge;
|
|
69
60
|
map.delegate = self;
|
|
70
61
|
map.isAccessibilityElement = NO;
|
|
@@ -217,32 +208,8 @@ RCT_EXPORT_METHOD(fitToElements:(nonnull NSNumber *)reactTag
|
|
|
217
208
|
if (![view isKindOfClass:[AIRGoogleMap class]]) {
|
|
218
209
|
RCTLogError(@"Invalid view returned from registry, expecting AIRGoogleMap, got: %@", view);
|
|
219
210
|
} else {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
CLLocationCoordinate2D myLocation = ((AIRGoogleMapMarker *)(mapView.markers.firstObject)).realMarker.position;
|
|
223
|
-
GMSCoordinateBounds *bounds = [[GMSCoordinateBounds alloc] initWithCoordinate:myLocation coordinate:myLocation];
|
|
224
|
-
|
|
225
|
-
for (AIRGoogleMapMarker *marker in mapView.markers)
|
|
226
|
-
bounds = [bounds includingCoordinate:marker.realMarker.position];
|
|
227
|
-
|
|
228
|
-
GMSCameraUpdate* cameraUpdate;
|
|
229
|
-
|
|
230
|
-
if ([edgePadding count] != 0) {
|
|
231
|
-
// Set Map viewport
|
|
232
|
-
CGFloat top = [RCTConvert CGFloat:edgePadding[@"top"]];
|
|
233
|
-
CGFloat right = [RCTConvert CGFloat:edgePadding[@"right"]];
|
|
234
|
-
CGFloat bottom = [RCTConvert CGFloat:edgePadding[@"bottom"]];
|
|
235
|
-
CGFloat left = [RCTConvert CGFloat:edgePadding[@"left"]];
|
|
236
|
-
|
|
237
|
-
cameraUpdate = [GMSCameraUpdate fitBounds:bounds withEdgeInsets:UIEdgeInsetsMake(top, left, bottom, right)];
|
|
238
|
-
} else {
|
|
239
|
-
cameraUpdate = [GMSCameraUpdate fitBounds:bounds withPadding:55.0f];
|
|
240
|
-
}
|
|
241
|
-
if (animated) {
|
|
242
|
-
[mapView animateWithCameraUpdate: cameraUpdate];
|
|
243
|
-
} else {
|
|
244
|
-
[mapView moveCamera: cameraUpdate];
|
|
245
|
-
}
|
|
211
|
+
AIRGoogleMap *mapView = (AIRGoogleMap *)view;
|
|
212
|
+
[mapView fitToElementsWithEdgePadding:edgePadding animated:animated];
|
|
246
213
|
}
|
|
247
214
|
}];
|
|
248
215
|
}
|
|
@@ -257,40 +224,14 @@ RCT_EXPORT_METHOD(fitToSuppliedMarkers:(nonnull NSNumber *)reactTag
|
|
|
257
224
|
if (![view isKindOfClass:[AIRGoogleMap class]]) {
|
|
258
225
|
RCTLogError(@"Invalid view returned from registry, expecting AIRGoogleMap, got: %@", view);
|
|
259
226
|
} else {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
NSPredicate *filterMarkers = [NSPredicate predicateWithBlock:^BOOL(id evaluatedObject, NSDictionary *bindings) {
|
|
263
|
-
AIRGoogleMapMarker *marker = (AIRGoogleMapMarker *)evaluatedObject;
|
|
264
|
-
return [marker isKindOfClass:[AIRGoogleMapMarker class]] && [markers containsObject:marker.identifier];
|
|
265
|
-
}];
|
|
266
|
-
|
|
267
|
-
NSArray *filteredMarkers = [mapView.markers filteredArrayUsingPredicate:filterMarkers];
|
|
268
|
-
|
|
269
|
-
CLLocationCoordinate2D myLocation = ((AIRGoogleMapMarker *)(filteredMarkers.firstObject)).realMarker.position;
|
|
270
|
-
GMSCoordinateBounds *bounds = [[GMSCoordinateBounds alloc] initWithCoordinate:myLocation coordinate:myLocation];
|
|
271
|
-
|
|
272
|
-
for (AIRGoogleMapMarker *marker in filteredMarkers)
|
|
273
|
-
bounds = [bounds includingCoordinate:marker.realMarker.position];
|
|
274
|
-
|
|
275
|
-
// Set Map viewport
|
|
276
|
-
CGFloat top = [RCTConvert CGFloat:edgePadding[@"top"]];
|
|
277
|
-
CGFloat right = [RCTConvert CGFloat:edgePadding[@"right"]];
|
|
278
|
-
CGFloat bottom = [RCTConvert CGFloat:edgePadding[@"bottom"]];
|
|
279
|
-
CGFloat left = [RCTConvert CGFloat:edgePadding[@"left"]];
|
|
280
|
-
|
|
281
|
-
GMSCameraUpdate* cameraUpdate = [GMSCameraUpdate fitBounds:bounds withEdgeInsets:UIEdgeInsetsMake(top, left, bottom, right)];
|
|
282
|
-
if (animated) {
|
|
283
|
-
[mapView animateWithCameraUpdate:cameraUpdate
|
|
284
|
-
];
|
|
285
|
-
} else {
|
|
286
|
-
[mapView moveCamera: cameraUpdate];
|
|
287
|
-
}
|
|
227
|
+
AIRGoogleMap *mapView = (AIRGoogleMap *)view;
|
|
228
|
+
[mapView fitToSuppliedMarkers:markers withEdgePadding:edgePadding animated:animated];
|
|
288
229
|
}
|
|
289
230
|
}];
|
|
290
231
|
}
|
|
291
232
|
|
|
292
233
|
RCT_EXPORT_METHOD(fitToCoordinates:(nonnull NSNumber *)reactTag
|
|
293
|
-
coordinates:(nonnull NSArray<
|
|
234
|
+
coordinates:(nonnull NSArray<AIRGoogleMapCoordinate *> *)coordinates
|
|
294
235
|
edgePadding:(nonnull NSDictionary *)edgePadding
|
|
295
236
|
animated:(BOOL)animated)
|
|
296
237
|
{
|
|
@@ -300,26 +241,7 @@ RCT_EXPORT_METHOD(fitToCoordinates:(nonnull NSNumber *)reactTag
|
|
|
300
241
|
RCTLogError(@"Invalid view returned from registry, expecting AIRGoogleMap, got: %@", view);
|
|
301
242
|
} else {
|
|
302
243
|
AIRGoogleMap *mapView = (AIRGoogleMap *)view;
|
|
303
|
-
|
|
304
|
-
CLLocationCoordinate2D myLocation = coordinates.firstObject.coordinate;
|
|
305
|
-
GMSCoordinateBounds *bounds = [[GMSCoordinateBounds alloc] initWithCoordinate:myLocation coordinate:myLocation];
|
|
306
|
-
|
|
307
|
-
for (AIRMapCoordinate *coordinate in coordinates)
|
|
308
|
-
bounds = [bounds includingCoordinate:coordinate.coordinate];
|
|
309
|
-
|
|
310
|
-
// Set Map viewport
|
|
311
|
-
CGFloat top = [RCTConvert CGFloat:edgePadding[@"top"]];
|
|
312
|
-
CGFloat right = [RCTConvert CGFloat:edgePadding[@"right"]];
|
|
313
|
-
CGFloat bottom = [RCTConvert CGFloat:edgePadding[@"bottom"]];
|
|
314
|
-
CGFloat left = [RCTConvert CGFloat:edgePadding[@"left"]];
|
|
315
|
-
|
|
316
|
-
GMSCameraUpdate *cameraUpdate = [GMSCameraUpdate fitBounds:bounds withEdgeInsets:UIEdgeInsetsMake(top, left, bottom, right)];
|
|
317
|
-
|
|
318
|
-
if (animated) {
|
|
319
|
-
[mapView animateWithCameraUpdate: cameraUpdate];
|
|
320
|
-
} else {
|
|
321
|
-
[mapView moveCamera: cameraUpdate];
|
|
322
|
-
}
|
|
244
|
+
[mapView fitToCoordinates:coordinates withEdgePadding:edgePadding animated:animated];
|
|
323
245
|
}
|
|
324
246
|
}];
|
|
325
247
|
}
|
|
@@ -331,7 +253,7 @@ RCT_EXPORT_METHOD(takeSnapshot:(nonnull NSNumber *)reactTag
|
|
|
331
253
|
format:(nonnull NSString *)format
|
|
332
254
|
quality:(nonnull NSNumber *)quality
|
|
333
255
|
result:(nonnull NSString *)result
|
|
334
|
-
withCallback:(
|
|
256
|
+
withCallback:(RCTPromiseResolveBlock)callback)
|
|
335
257
|
{
|
|
336
258
|
NSTimeInterval timeStamp = [[NSDate date] timeIntervalSince1970];
|
|
337
259
|
NSString *pathComponent = [NSString stringWithFormat:@"Documents/snapshot-%.20lf.%@", timeStamp, format];
|
|
@@ -342,7 +264,19 @@ RCT_EXPORT_METHOD(takeSnapshot:(nonnull NSNumber *)reactTag
|
|
|
342
264
|
if (![view isKindOfClass:[AIRGoogleMap class]]) {
|
|
343
265
|
RCTLogError(@"Invalid view returned from registry, expecting AIRMap, got: %@", view);
|
|
344
266
|
} else {
|
|
345
|
-
|
|
267
|
+
AIRGoogleMap *mapView = (AIRGoogleMap *)view;
|
|
268
|
+
NSMutableDictionary* config = [NSMutableDictionary new];
|
|
269
|
+
|
|
270
|
+
[mapView takeSnapshotWithConfig:config success:callback error:^(NSString *code, NSString *message, NSError *error) {
|
|
271
|
+
callback(@[error]);
|
|
272
|
+
}];
|
|
273
|
+
|
|
274
|
+
[config setObject:width forKey:@"width"];
|
|
275
|
+
[config setObject:height forKey:@"height"];
|
|
276
|
+
[config setObject:format forKey:@"format"];
|
|
277
|
+
[config setObject:quality forKey:@"quality"];
|
|
278
|
+
[config setObject:result forKey:@"result"];
|
|
279
|
+
[config setObject:filePath forKey:@"filePath"];
|
|
346
280
|
|
|
347
281
|
// TODO: currently we are ignoring width, height, region
|
|
348
282
|
|
|
@@ -388,13 +322,7 @@ RCT_EXPORT_METHOD(pointForCoordinate:(nonnull NSNumber *)reactTag
|
|
|
388
322
|
RCTLogError(@"Invalid view returned from registry, expecting AIRMap, got: %@", view);
|
|
389
323
|
} else {
|
|
390
324
|
AIRGoogleMap *mapView = (AIRGoogleMap *)view;
|
|
391
|
-
|
|
392
|
-
CGPoint touchPoint = [mapView.projection pointForCoordinate:coord];
|
|
393
|
-
|
|
394
|
-
resolve(@{
|
|
395
|
-
@"x": @(touchPoint.x),
|
|
396
|
-
@"y": @(touchPoint.y),
|
|
397
|
-
});
|
|
325
|
+
resolve([mapView getPointForCoordinates:coord]);
|
|
398
326
|
}
|
|
399
327
|
}];
|
|
400
328
|
}
|
|
@@ -415,13 +343,7 @@ RCT_EXPORT_METHOD(coordinateForPoint:(nonnull NSNumber *)reactTag
|
|
|
415
343
|
RCTLogError(@"Invalid view returned from registry, expecting AIRMap, got: %@", view);
|
|
416
344
|
} else {
|
|
417
345
|
AIRGoogleMap *mapView = (AIRGoogleMap *)view;
|
|
418
|
-
|
|
419
|
-
CLLocationCoordinate2D coordinate = [mapView.projection coordinateForPoint:pt];
|
|
420
|
-
|
|
421
|
-
resolve(@{
|
|
422
|
-
@"latitude": @(coordinate.latitude),
|
|
423
|
-
@"longitude": @(coordinate.longitude),
|
|
424
|
-
});
|
|
346
|
+
resolve([view getCoordinatesForPoint:pt]);
|
|
425
347
|
}
|
|
426
348
|
}];
|
|
427
349
|
}
|
|
@@ -451,18 +373,7 @@ RCT_EXPORT_METHOD(getMapBoundaries:(nonnull NSNumber *)reactTag
|
|
|
451
373
|
if (![view isKindOfClass:[AIRGoogleMap class]]) {
|
|
452
374
|
RCTLogError(@"Invalid view returned from registry, expecting AIRGoogleMap, got: %@", view);
|
|
453
375
|
} else {
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
resolve(@{
|
|
457
|
-
@"northEast" : @{
|
|
458
|
-
@"longitude" : boundingBox[0][0],
|
|
459
|
-
@"latitude" : boundingBox[0][1]
|
|
460
|
-
},
|
|
461
|
-
@"southWest" : @{
|
|
462
|
-
@"longitude" : boundingBox[1][0],
|
|
463
|
-
@"latitude" : boundingBox[1][1]
|
|
464
|
-
}
|
|
465
|
-
});
|
|
376
|
+
resolve([view getMapBoundaries]);
|
|
466
377
|
}
|
|
467
378
|
}];
|
|
468
379
|
}
|