react-native-maps 1.21.0-alpha.34 → 1.21.0-alpha.36
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.
|
@@ -362,6 +362,19 @@ id regionAsJSON(MKCoordinateRegion region) {
|
|
|
362
362
|
];
|
|
363
363
|
}
|
|
364
364
|
|
|
365
|
+
- (NSDictionary *) getCameraDic {
|
|
366
|
+
MKMapCamera *camera = [self camera];
|
|
367
|
+
return @{
|
|
368
|
+
@"center": @{
|
|
369
|
+
@"latitude": @(camera.centerCoordinate.latitude),
|
|
370
|
+
@"longitude": @(camera.centerCoordinate.longitude),
|
|
371
|
+
},
|
|
372
|
+
@"pitch": @(camera.pitch),
|
|
373
|
+
@"heading": @(camera.heading),
|
|
374
|
+
@"altitude": @(camera.altitude),
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
|
|
365
378
|
- (void)layoutSubviews {
|
|
366
379
|
[super layoutSubviews];
|
|
367
380
|
if(_didLayoutSubviews) return;
|
package/ios/AirMaps/AIRMap.h
CHANGED
package/ios/AirMaps/AIRMap.m
CHANGED
|
@@ -51,6 +51,7 @@ const NSInteger AIRMapMaxZoomLevel = 20;
|
|
|
51
51
|
BOOL _initialRegionSet;
|
|
52
52
|
BOOL _initialCameraSet;
|
|
53
53
|
BOOL _initialized;
|
|
54
|
+
BOOL _loadingStarted;
|
|
54
55
|
|
|
55
56
|
// Array to manually track RN subviews
|
|
56
57
|
//
|
|
@@ -102,9 +103,6 @@ const NSInteger AIRMapMaxZoomLevel = 20;
|
|
|
102
103
|
[super addSubview:view];
|
|
103
104
|
}
|
|
104
105
|
}
|
|
105
|
-
- (void) didSetRegion {
|
|
106
|
-
_initialRegionSet = YES;
|
|
107
|
-
}
|
|
108
106
|
|
|
109
107
|
#pragma clang diagnostic push
|
|
110
108
|
#pragma clang diagnostic ignored "-Wobjc-missing-super-calls"
|
|
@@ -381,7 +379,7 @@ const NSInteger AIRMapMaxZoomLevel = 20;
|
|
|
381
379
|
return markersFrames;
|
|
382
380
|
}
|
|
383
381
|
|
|
384
|
-
- (NSDictionary *)
|
|
382
|
+
- (NSDictionary *) getCameraDic {
|
|
385
383
|
MKMapCamera *camera = [self camera];
|
|
386
384
|
return @{
|
|
387
385
|
@"center": @{
|
|
@@ -572,12 +570,23 @@ const NSInteger AIRMapMaxZoomLevel = 20;
|
|
|
572
570
|
// Animate/move to new position
|
|
573
571
|
[super setRegion:region animated:animated];
|
|
574
572
|
}
|
|
573
|
+
- (void) setRegion:(MKCoordinateRegion)region
|
|
574
|
+
{
|
|
575
|
+
if (!CLLocationCoordinate2DIsValid(region.center)) {
|
|
576
|
+
return;
|
|
577
|
+
}
|
|
578
|
+
if (!CLLocationCoordinate2DIsValid(_initialRegion.center)) {
|
|
579
|
+
[self setInitialRegion:region];
|
|
580
|
+
}
|
|
581
|
+
[self setRegion:region animated:NO];
|
|
582
|
+
}
|
|
575
583
|
|
|
576
584
|
- (void)setInitialRegion:(MKCoordinateRegion)initialRegion {
|
|
577
585
|
if (!CLLocationCoordinate2DIsValid(initialRegion.center)) {
|
|
578
586
|
return;
|
|
579
587
|
}
|
|
580
|
-
|
|
588
|
+
_initialRegion = initialRegion;
|
|
589
|
+
if (!_initialRegionSet && _loadingStarted) {
|
|
581
590
|
_initialRegionSet = YES;
|
|
582
591
|
[self setRegion:initialRegion animated:NO];
|
|
583
592
|
}
|
|
@@ -810,6 +819,9 @@ const NSInteger AIRMapMaxZoomLevel = 20;
|
|
|
810
819
|
self.loadingView.hidden = YES;
|
|
811
820
|
}
|
|
812
821
|
}
|
|
822
|
+
_loadingStarted = YES;
|
|
823
|
+
// loadRegion
|
|
824
|
+
[self setInitialRegion:_initialRegion];
|
|
813
825
|
}
|
|
814
826
|
|
|
815
827
|
- (void)finishLoading {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
resolve:(RCTPromiseResolveBlock)resolve
|
|
38
38
|
reject:(RCTPromiseRejectBlock)reject {
|
|
39
39
|
[self executeWithMapView:tag success:^(id<RNMapsAirModuleDelegate> mapView) {
|
|
40
|
-
resolve([mapView
|
|
40
|
+
resolve([mapView getCameraDic]);
|
|
41
41
|
} reject:reject];
|
|
42
42
|
|
|
43
43
|
}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
- (void)takeSnapshotWithConfig:(NSDictionary *)config
|
|
17
17
|
success:(RCTPromiseResolveBlock) success error:(RCTPromiseRejectBlock) error;
|
|
18
18
|
|
|
19
|
-
- (NSDictionary *)
|
|
19
|
+
- (NSDictionary *) getCameraDic;
|
|
20
20
|
- (NSDictionary*) getMarkersFramesWithOnlyVisible:(BOOL)onlyVisible;
|
|
21
21
|
- (NSArray *) getMapBoundaries;
|
|
22
22
|
- (NSDictionary *) getPointForCoordinates:(CLLocationCoordinate2D) location;
|
|
@@ -445,7 +445,6 @@ newViewProps.name.longitudeDelta); \
|
|
|
445
445
|
MKCoordinateRegion region = MKCoordinateRegionMake(CLLocationCoordinate2DMake( \
|
|
446
446
|
newViewProps.name.latitude, newViewProps.name.longitude), span); \
|
|
447
447
|
_view.name = region; \
|
|
448
|
-
[_view didSetRegion]; \
|
|
449
448
|
}
|
|
450
449
|
|
|
451
450
|
#define REMAP_MAPVIEW_CAMERA_PROP(name) \
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"author": "Leland Richardson <leland.m.richardson@gmail.com>",
|
|
7
7
|
"homepage": "https://github.com/react-native-maps/react-native-maps#readme",
|
|
8
|
-
"version": "1.21.0-alpha.
|
|
8
|
+
"version": "1.21.0-alpha.36",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"lint": "eslint . --max-warnings 0",
|