react-native-maps 2.0.0-beta.14 → 2.0.0-beta.15
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/ios/Maps/RNMMap.h +1 -0
- package/ios/Maps/RNMMap.m +11 -0
- package/ios/Maps/RNMMapManager.m +19 -0
- package/package.json +1 -1
package/ios/Maps/RNMMap.h
CHANGED
|
@@ -29,6 +29,7 @@ extern const NSInteger RNMMapMaxZoomLevel;
|
|
|
29
29
|
@property (nonatomic, assign) BOOL ignoreRegionChanges;
|
|
30
30
|
@property (nonatomic, assign) BOOL mapLoaded;
|
|
31
31
|
@property (nonatomic, assign) BOOL userLocationCalloutEnabled;
|
|
32
|
+
@property (nonatomic, assign) BOOL mapChangedFromUserInteraction;
|
|
32
33
|
@property (nonatomic, assign) CGFloat maxDelta;
|
|
33
34
|
@property (nonatomic, assign) CGFloat maxZoomLevel;
|
|
34
35
|
@property (nonatomic, assign) CGFloat minDelta;
|
package/ios/Maps/RNMMap.m
CHANGED
|
@@ -86,6 +86,7 @@ const NSInteger RNMMapMaxZoomLevel = 20;
|
|
|
86
86
|
self.minZoomLevel = 0;
|
|
87
87
|
self.maxZoomLevel = RNMMapMaxZoomLevel;
|
|
88
88
|
self.compassOffset = CGPointMake(0, 0);
|
|
89
|
+
self.mapChangedFromUserInteraction = NO;
|
|
89
90
|
}
|
|
90
91
|
return self;
|
|
91
92
|
}
|
|
@@ -405,6 +406,11 @@ const NSInteger RNMMapMaxZoomLevel = 20;
|
|
|
405
406
|
region.span.longitudeDelta = self.region.span.longitudeDelta;
|
|
406
407
|
}
|
|
407
408
|
|
|
409
|
+
// If the region was changed with an animation, there is no way it was a user interaction
|
|
410
|
+
if (animated) {
|
|
411
|
+
self.mapChangedFromUserInteraction = NO;
|
|
412
|
+
}
|
|
413
|
+
|
|
408
414
|
// Animate/move to new position
|
|
409
415
|
[super setRegion:region animated:animated];
|
|
410
416
|
}
|
|
@@ -418,6 +424,11 @@ const NSInteger RNMMapMaxZoomLevel = 20;
|
|
|
418
424
|
|
|
419
425
|
- (void)setCamera:(MKMapCamera*)camera animated:(BOOL)animated
|
|
420
426
|
{
|
|
427
|
+
// If the camera was changed with an animation, there is no way it was a user interaction
|
|
428
|
+
if (animated) {
|
|
429
|
+
self.mapChangedFromUserInteraction = NO;
|
|
430
|
+
}
|
|
431
|
+
|
|
421
432
|
[super setCamera:camera animated:animated];
|
|
422
433
|
}
|
|
423
434
|
|
package/ios/Maps/RNMMapManager.m
CHANGED
|
@@ -513,6 +513,24 @@ static int kDragCenterContext;
|
|
|
513
513
|
[self _regionChanged:mapView];
|
|
514
514
|
}
|
|
515
515
|
|
|
516
|
+
- (BOOL)mapViewRegionDidChangeFromUserInteraction:(RNMMap *)mapView
|
|
517
|
+
{
|
|
518
|
+
UIView *view = mapView.subviews.firstObject;
|
|
519
|
+
// Look through gesture recognizers to determine whether this region change is from user interaction
|
|
520
|
+
for(UIGestureRecognizer *recognizer in view.gestureRecognizers) {
|
|
521
|
+
if(recognizer.state == UIGestureRecognizerStateBegan || recognizer.state == UIGestureRecognizerStateChanged || recognizer.state == UIGestureRecognizerStateEnded) {
|
|
522
|
+
return YES;
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
return NO;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
- (void)mapView:(RNMMap *)mapView regionWillChangeAnimated:(BOOL)animated
|
|
530
|
+
{
|
|
531
|
+
mapView.mapChangedFromUserInteraction = [self mapViewRegionDidChangeFromUserInteraction: mapView];
|
|
532
|
+
}
|
|
533
|
+
|
|
516
534
|
- (void)mapView:(RNMMap *)mapView regionDidChangeAnimated:(__unused BOOL)animated
|
|
517
535
|
{
|
|
518
536
|
CGFloat zoomLevel = [self zoomLevel:mapView];
|
|
@@ -598,6 +616,7 @@ static int kDragCenterContext;
|
|
|
598
616
|
#define FLUSH_NAN(value) (isnan(value) ? 0 : value)
|
|
599
617
|
mapView.onChange(@{
|
|
600
618
|
@"continuous": @(continuous),
|
|
619
|
+
@"isGesture": @(mapView.mapChangedFromUserInteraction),
|
|
601
620
|
@"region": @{
|
|
602
621
|
@"latitude": @(FLUSH_NAN(region.center.latitude)),
|
|
603
622
|
@"longitude": @(FLUSH_NAN(region.center.longitude)),
|
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": "2.0.0-beta.
|
|
8
|
+
"version": "2.0.0-beta.15",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"lint": "eslint . --max-warnings 0",
|