react-native-maps 1.24.5 → 1.24.7

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/README.md CHANGED
@@ -29,7 +29,7 @@ See [Setup Instructions for the Included Example Project](docs/examples-setup.md
29
29
 
30
30
  #### Old Arch
31
31
 
32
- - **Version `1.21.0` and below**: Requires **React Native `>= 0.74`**.
32
+ - **Version `1.21.1` and below**: Requires **React Native `>= 0.74`**.
33
33
  - **Version `1.14.0` and above**: Requires **React Native `>= 0.74`**.
34
34
  - **Versions below `1.14.0`**: Require **React Native `>= 0.64.3`**.
35
35
 
@@ -18,10 +18,9 @@ public class OnRegionChangeEvent extends Event<OnRegionChangeEvent> {
18
18
  super(surfaceId, viewId);
19
19
  this.payload = payload;
20
20
  }
21
- public static WritableMap payLoadFor(LatLngBounds bounds, boolean continuous, boolean isGesture){
21
+ public static WritableMap payLoadFor(LatLngBounds bounds, boolean isGesture) {
22
22
 
23
23
  WritableMap event = new WritableNativeMap();
24
- event.putBoolean("continuous", continuous);
25
24
  WritableMap region = new WritableNativeMap();
26
25
  LatLng center = bounds.getCenter();
27
26
  region.putDouble("latitude", center.latitude);
@@ -594,17 +594,17 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
594
594
 
595
595
  map.setOnCameraMoveStartedListener(reason -> {
596
596
  cameraMoveReason = reason;
597
+ LatLngBounds bounds = map.getProjection().getVisibleRegion().latLngBounds;
597
598
  boolean isGesture = GoogleMap.OnCameraMoveStartedListener.REASON_GESTURE == reason;
598
- WritableMap event = new WritableNativeMap();
599
- event.putBoolean("isGesture", isGesture);
600
- dispatchEvent(event, OnRegionChangeStartEvent::new);
599
+ WritableMap payload = OnRegionChangeEvent.payLoadFor(bounds, isGesture);
600
+ dispatchEvent(payload, OnRegionChangeStartEvent::new);
601
601
  });
602
602
 
603
603
  map.setOnCameraMoveListener(() -> {
604
604
  LatLngBounds bounds = map.getProjection().getVisibleRegion().latLngBounds;
605
605
  cameraLastIdleBounds = null;
606
606
  boolean isGesture = GoogleMap.OnCameraMoveStartedListener.REASON_GESTURE == cameraMoveReason;
607
- WritableMap payload = OnRegionChangeEvent.payLoadFor(bounds, true, isGesture);
607
+ WritableMap payload = OnRegionChangeEvent.payLoadFor(bounds, isGesture);
608
608
  dispatchEvent(payload, OnRegionChangeEvent::new);
609
609
  });
610
610
 
@@ -616,7 +616,7 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
616
616
 
617
617
  cameraLastIdleBounds = bounds;
618
618
  boolean isGesture = GoogleMap.OnCameraMoveStartedListener.REASON_GESTURE == cameraMoveReason;
619
- WritableMap payload = OnRegionChangeEvent.payLoadFor(bounds, false, isGesture);
619
+ WritableMap payload = OnRegionChangeEvent.payLoadFor(bounds, isGesture);
620
620
  dispatchEvent(payload, OnRegionChangeCompleteEvent::new);
621
621
  }
622
622
  });
@@ -9,13 +9,11 @@ import com.google.android.gms.maps.model.LatLngBounds;
9
9
 
10
10
  public class RegionChangeEvent extends Event<RegionChangeEvent> {
11
11
  private final LatLngBounds bounds;
12
- private final boolean continuous;
13
12
  private final boolean isGesture;
14
13
 
15
- public RegionChangeEvent(int id, LatLngBounds bounds, boolean continuous, boolean isGesture) {
14
+ public RegionChangeEvent(int id, LatLngBounds bounds, boolean isGesture) {
16
15
  super(id);
17
16
  this.bounds = bounds;
18
- this.continuous = continuous;
19
17
  this.isGesture = isGesture;
20
18
  }
21
19
 
@@ -32,7 +30,6 @@ public class RegionChangeEvent extends Event<RegionChangeEvent> {
32
30
  @Override
33
31
  public void dispatch(RCTEventEmitter rctEventEmitter) {
34
32
  WritableMap event = new WritableNativeMap();
35
- event.putBoolean("continuous", continuous);
36
33
 
37
34
  WritableMap region = new WritableNativeMap();
38
35
  LatLng center = bounds.getCenter();
@@ -318,7 +318,7 @@ void RNMapsGoogleMapViewEventEmitter::onRegionChangeStart(OnRegionChangeStart $e
318
318
  region.setProperty(runtime, "longitudeDelta", $event.region.longitudeDelta);
319
319
  $payload.setProperty(runtime, "region", region);
320
320
  }
321
- $payload.setProperty(runtime, "continuous", $event.continuous);
321
+ $payload.setProperty(runtime, "isGesture", $event.isGesture);
322
322
  return $payload;
323
323
  });
324
324
  }
@@ -335,7 +335,7 @@ void RNMapsGoogleMapViewEventEmitter::onRegionChange(OnRegionChange $event) cons
335
335
  region.setProperty(runtime, "longitudeDelta", $event.region.longitudeDelta);
336
336
  $payload.setProperty(runtime, "region", region);
337
337
  }
338
- $payload.setProperty(runtime, "continuous", $event.continuous);
338
+ $payload.setProperty(runtime, "isGesture", $event.isGesture);
339
339
  return $payload;
340
340
  });
341
341
  }
@@ -352,7 +352,7 @@ void RNMapsGoogleMapViewEventEmitter::onRegionChangeComplete(OnRegionChangeCompl
352
352
  region.setProperty(runtime, "longitudeDelta", $event.region.longitudeDelta);
353
353
  $payload.setProperty(runtime, "region", region);
354
354
  }
355
- $payload.setProperty(runtime, "continuous", $event.continuous);
355
+ $payload.setProperty(runtime, "isGesture", $event.isGesture);
356
356
  return $payload;
357
357
  });
358
358
  }
@@ -730,7 +730,7 @@ void RNMapsMapViewEventEmitter::onRegionChangeStart(OnRegionChangeStart $event)
730
730
  region.setProperty(runtime, "longitudeDelta", $event.region.longitudeDelta);
731
731
  $payload.setProperty(runtime, "region", region);
732
732
  }
733
- $payload.setProperty(runtime, "continuous", $event.continuous);
733
+ $payload.setProperty(runtime, "isGesture", $event.isGesture);
734
734
  return $payload;
735
735
  });
736
736
  }
@@ -747,7 +747,7 @@ void RNMapsMapViewEventEmitter::onRegionChange(OnRegionChange $event) const {
747
747
  region.setProperty(runtime, "longitudeDelta", $event.region.longitudeDelta);
748
748
  $payload.setProperty(runtime, "region", region);
749
749
  }
750
- $payload.setProperty(runtime, "continuous", $event.continuous);
750
+ $payload.setProperty(runtime, "isGesture", $event.isGesture);
751
751
  return $payload;
752
752
  });
753
753
  }
@@ -764,7 +764,7 @@ void RNMapsMapViewEventEmitter::onRegionChangeComplete(OnRegionChangeComplete $e
764
764
  region.setProperty(runtime, "longitudeDelta", $event.region.longitudeDelta);
765
765
  $payload.setProperty(runtime, "region", region);
766
766
  }
767
- $payload.setProperty(runtime, "continuous", $event.continuous);
767
+ $payload.setProperty(runtime, "isGesture", $event.isGesture);
768
768
  return $payload;
769
769
  });
770
770
  }
@@ -245,7 +245,7 @@ class RNMapsGoogleMapViewEventEmitter : public ViewEventEmitter {
245
245
 
246
246
  struct OnRegionChangeStart {
247
247
  OnRegionChangeStartRegion region;
248
- bool continuous;
248
+ bool isGesture;
249
249
  };
250
250
 
251
251
  struct OnRegionChangeRegion {
@@ -257,7 +257,7 @@ class RNMapsGoogleMapViewEventEmitter : public ViewEventEmitter {
257
257
 
258
258
  struct OnRegionChange {
259
259
  OnRegionChangeRegion region;
260
- bool continuous;
260
+ bool isGesture;
261
261
  };
262
262
 
263
263
  struct OnRegionChangeCompleteRegion {
@@ -269,7 +269,7 @@ class RNMapsGoogleMapViewEventEmitter : public ViewEventEmitter {
269
269
 
270
270
  struct OnRegionChangeComplete {
271
271
  OnRegionChangeCompleteRegion region;
272
- bool continuous;
272
+ bool isGesture;
273
273
  };
274
274
 
275
275
  struct OnUserLocationChangeCoordinate {
@@ -593,7 +593,7 @@ class RNMapsMapViewEventEmitter : public ViewEventEmitter {
593
593
 
594
594
  struct OnRegionChangeStart {
595
595
  OnRegionChangeStartRegion region;
596
- bool continuous;
596
+ bool isGesture;
597
597
  };
598
598
 
599
599
  struct OnRegionChangeRegion {
@@ -605,7 +605,7 @@ class RNMapsMapViewEventEmitter : public ViewEventEmitter {
605
605
 
606
606
  struct OnRegionChange {
607
607
  OnRegionChangeRegion region;
608
- bool continuous;
608
+ bool isGesture;
609
609
  };
610
610
 
611
611
  struct OnRegionChangeCompleteRegion {
@@ -617,7 +617,7 @@ class RNMapsMapViewEventEmitter : public ViewEventEmitter {
617
617
 
618
618
  struct OnRegionChangeComplete {
619
619
  OnRegionChangeCompleteRegion region;
620
- bool continuous;
620
+ bool isGesture;
621
621
  };
622
622
 
623
623
  struct OnUserLocationChangeCoordinate {
@@ -519,17 +519,19 @@ id regionAsJSON(MKCoordinateRegion region) {
519
519
 
520
520
  - (void)willMove:(BOOL)gesture {
521
521
  _isAnimating = YES;
522
- id event = @{@"isGesture": [NSNumber numberWithBool:gesture]};
523
- if (self.onRegionChangeStart) self.onRegionChangeStart(event);
522
+ GMSCameraPosition *position = self.camera;
523
+ id event = @{@"region": regionAsJSON([AIRGoogleMap makeGMSCameraPositionFromMap:self andGMSCameraPosition:position]),
524
+ @"isGesture": [NSNumber numberWithBool:gesture],
525
+ };
526
+ if (self.onRegionChangeStart) self.onRegionChangeStart(event);
524
527
  }
525
528
 
526
529
  - (void)didChangeCameraPosition:(GMSCameraPosition *)position isGesture:(BOOL)isGesture{
527
- id event = @{@"continuous": @YES,
528
- @"region": regionAsJSON([AIRGoogleMap makeGMSCameraPositionFromMap:self andGMSCameraPosition:position]),
529
- @"isGesture": [NSNumber numberWithBool:isGesture],
530
- };
531
-
532
- if (self.onRegionChange) self.onRegionChange(event);
530
+ id event = @{@"region": regionAsJSON([AIRGoogleMap makeGMSCameraPositionFromMap:self andGMSCameraPosition:position]),
531
+ @"isGesture": [NSNumber numberWithBool:isGesture],
532
+ };
533
+
534
+ if (self.onRegionChange) self.onRegionChange(event);
533
535
  }
534
536
 
535
537
  - (void)didTapPOIWithPlaceID:(NSString *)placeID
@@ -547,10 +549,9 @@ id regionAsJSON(MKCoordinateRegion region) {
547
549
  }
548
550
 
549
551
  - (void)idleAtCameraPosition:(GMSCameraPosition *)position isGesture:(BOOL)isGesture{
550
- id event = @{@"continuous": @NO,
551
- @"region": regionAsJSON([AIRGoogleMap makeGMSCameraPositionFromMap:self andGMSCameraPosition:position]),
552
- @"isGesture": [NSNumber numberWithBool:isGesture],
553
- };
552
+ id event = @{@"region": regionAsJSON([AIRGoogleMap makeGMSCameraPositionFromMap:self andGMSCameraPosition:position]),
553
+ @"isGesture": [NSNumber numberWithBool:isGesture],
554
+ };
554
555
  if (self.onRegionChangeComplete) self.onRegionChangeComplete(event); // complete
555
556
  _isAnimating = NO;
556
557
  }
@@ -265,7 +265,7 @@ using namespace facebook::react;
265
265
  .region.longitude = [regionDict[@"longitude"] doubleValue],
266
266
  .region.latitudeDelta = [regionDict[@"latitudeDelta"] doubleValue],
267
267
  .region.longitudeDelta = [regionDict[@"longitudeDelta"] doubleValue],
268
- .continuous = [dictionary[@"continuous"] boolValue],
268
+ .isGesture = [dictionary[@"isGesture"] boolValue],
269
269
  };
270
270
  mapViewEventEmitter->onRegionChange(data);
271
271
  }
@@ -358,8 +358,6 @@ using namespace facebook::react;
358
358
  }
359
359
  };
360
360
 
361
-
362
-
363
361
  _view.onRegionChangeStart = [self](NSDictionary* dictionary) {
364
362
  if (_eventEmitter) {
365
363
 
@@ -370,7 +368,7 @@ using namespace facebook::react;
370
368
  .region.longitude = [regionDict[@"longitude"] doubleValue],
371
369
  .region.latitudeDelta = [regionDict[@"latitudeDelta"] doubleValue],
372
370
  .region.longitudeDelta = [regionDict[@"longitudeDelta"] doubleValue],
373
- .continuous = [dictionary[@"continuous"] boolValue],
371
+ .isGesture = [dictionary[@"isGesture"] boolValue],
374
372
  };
375
373
  mapViewEventEmitter->onRegionChangeStart(data);
376
374
  }
@@ -386,7 +384,7 @@ using namespace facebook::react;
386
384
  .region.longitude = [regionDict[@"longitude"] doubleValue],
387
385
  .region.latitudeDelta = [regionDict[@"latitudeDelta"] doubleValue],
388
386
  .region.longitudeDelta = [regionDict[@"longitudeDelta"] doubleValue],
389
- .continuous = [dictionary[@"continuous"] boolValue],
387
+ .isGesture = [dictionary[@"isGesture"] boolValue],
390
388
  };
391
389
  mapViewEventEmitter->onRegionChangeComplete(data);
392
390
  }
@@ -57,7 +57,9 @@ extern const NSInteger AIRMapMaxZoomLevel;
57
57
  @property (nonatomic, assign) BOOL ignoreRegionChanges;
58
58
 
59
59
  @property (nonatomic, copy) RCTDirectEventBlock onMapReady;
60
+ @property (nonatomic, copy) RCTDirectEventBlock onRegionChangeStart;
60
61
  @property (nonatomic, copy) RCTDirectEventBlock onRegionChange;
62
+ @property (nonatomic, copy) RCTDirectEventBlock onRegionChangeComplete;
61
63
  @property (nonatomic, copy) RCTBubblingEventBlock onPress;
62
64
  @property (nonatomic, copy) RCTBubblingEventBlock onLongPress;
63
65
  @property (nonatomic, copy) RCTDirectEventBlock onPanDrag;
@@ -70,7 +72,6 @@ extern const NSInteger AIRMapMaxZoomLevel;
70
72
  @property (nonatomic, copy) RCTDirectEventBlock onMarkerDragEnd;
71
73
 
72
74
  @property (nonatomic, copy) RCTDirectEventBlock onCalloutPress;
73
- @property (nonatomic, copy) RCTDirectEventBlock onRegionChangeStart;
74
75
  @property (nonatomic, copy) RCTDirectEventBlock onUserLocationChange;
75
76
 
76
77
  - (void)cacheViewIfNeeded;
@@ -112,8 +112,9 @@ RCT_EXPORT_VIEW_PROPERTY(mapPadding, UIEdgeInsets)
112
112
  RCT_EXPORT_VIEW_PROPERTY(mapType, MKMapType)
113
113
  RCT_EXPORT_VIEW_PROPERTY(cameraZoomRange, NSDictionary)
114
114
  RCT_EXPORT_VIEW_PROPERTY(onMapReady, RCTDirectEventBlock)
115
- RCT_EXPORT_VIEW_PROPERTY(onRegionChange, RCTDirectEventBlock)
116
115
  RCT_EXPORT_VIEW_PROPERTY(onRegionChangeStart, RCTDirectEventBlock)
116
+ RCT_EXPORT_VIEW_PROPERTY(onRegionChange, RCTDirectEventBlock)
117
+ RCT_EXPORT_VIEW_PROPERTY(onRegionChangeComplete, RCTDirectEventBlock)
117
118
  RCT_EXPORT_VIEW_PROPERTY(onPanDrag, RCTDirectEventBlock)
118
119
  RCT_EXPORT_VIEW_PROPERTY(onPress, RCTBubblingEventBlock)
119
120
  RCT_EXPORT_VIEW_PROPERTY(onLongPress, RCTBubblingEventBlock)
@@ -912,12 +913,24 @@ static int kDragCenterContext;
912
913
 
913
914
  - (void)mapView:(AIRMap *)mapView regionWillChangeAnimated:(BOOL)animated
914
915
  {
915
- if (mapView.onRegionChangeStart) mapView.onRegionChangeStart(@{});
916
+ MKCoordinateRegion region = mapView.region;
917
+ if (!CLLocationCoordinate2DIsValid(region.center)) {
918
+ return;
919
+ }
920
+ #define FLUSH_NAN(value) (isnan(value) ? 0 : value)
921
+ if (mapView.onRegionChangeStart) mapView.onRegionChangeStart(@{
922
+ @"region": @{
923
+ @"latitude": @(FLUSH_NAN(region.center.latitude)),
924
+ @"longitude": @(FLUSH_NAN(region.center.longitude)),
925
+ @"latitudeDelta": @(FLUSH_NAN(region.span.latitudeDelta)),
926
+ @"longitudeDelta": @(FLUSH_NAN(region.span.longitudeDelta)),
927
+ }
928
+ });
916
929
  }
917
930
 
918
931
  - (void)mapViewDidChangeVisibleRegion:(AIRMap *)mapView
919
932
  {
920
- [self _regionChanged:mapView];
933
+ [self _regionChanged:mapView continuous:YES];
921
934
  }
922
935
 
923
936
  - (void)mapView:(AIRMap *)mapView regionDidChangeAnimated:(__unused BOOL)animated
@@ -927,9 +940,6 @@ static int kDragCenterContext;
927
940
  if (animated && mapView.ignoreRegionChanges){
928
941
  mapView.ignoreRegionChanges = false;
929
942
  }
930
- if(mapView.hasStartedRendering){
931
- [self _regionChanged:mapView];
932
- }
933
943
 
934
944
  if (mapView.legacyZoomConstraintsEnabled == YES) {
935
945
  [self applyLegacyZoomConstrains:mapView];
@@ -964,7 +974,7 @@ static int kDragCenterContext;
964
974
 
965
975
  #pragma mark Private
966
976
 
967
- - (void)_regionChanged:(AIRMap *)mapView
977
+ - (void)_regionChanged:(AIRMap *)mapView continuous:(BOOL)continuous
968
978
  {
969
979
  BOOL needZoom = NO;
970
980
  CGFloat newLongitudeDelta = 0.0f;
@@ -990,7 +1000,7 @@ static int kDragCenterContext;
990
1000
  }
991
1001
 
992
1002
  // Continuously observe region changes
993
- [self _emitRegionChangeEvent:mapView continuous:YES];
1003
+ [self _emitRegionChangeEvent:mapView continuous:continuous];
994
1004
  }
995
1005
 
996
1006
  - (void)_emitRegionChangeEvent:(AIRMap *)mapView continuous:(BOOL)continuous
@@ -1000,17 +1010,23 @@ static int kDragCenterContext;
1000
1010
  if (!CLLocationCoordinate2DIsValid(region.center)) {
1001
1011
  return;
1002
1012
  }
1003
-
1013
+
1004
1014
  #define FLUSH_NAN(value) (isnan(value) ? 0 : value)
1005
- mapView.onRegionChange(@{
1006
- @"continuous": @(continuous),
1007
- @"region": @{
1008
- @"latitude": @(FLUSH_NAN(region.center.latitude)),
1009
- @"longitude": @(FLUSH_NAN(region.center.longitude)),
1010
- @"latitudeDelta": @(FLUSH_NAN(region.span.latitudeDelta)),
1011
- @"longitudeDelta": @(FLUSH_NAN(region.span.longitudeDelta)),
1012
- }
1013
- });
1015
+ NSDictionary *payload = @{
1016
+ @"region": @{
1017
+ @"latitude": @(FLUSH_NAN(region.center.latitude)),
1018
+ @"longitude": @(FLUSH_NAN(region.center.longitude)),
1019
+ @"latitudeDelta": @(FLUSH_NAN(region.span.latitudeDelta)),
1020
+ @"longitudeDelta": @(FLUSH_NAN(region.span.longitudeDelta)),
1021
+ }
1022
+ };
1023
+
1024
+
1025
+ if (continuous && mapView.onRegionChange) {
1026
+ mapView.onRegionChange(payload);
1027
+ } else if (mapView.onRegionChangeComplete) {
1028
+ mapView.onRegionChangeComplete(payload);
1029
+ }
1014
1030
  }
1015
1031
  }
1016
1032
 
@@ -206,7 +206,7 @@ using namespace facebook::react;
206
206
  .region.longitude = [regionDict[@"longitude"] doubleValue],
207
207
  .region.latitudeDelta = [regionDict[@"latitudeDelta"] doubleValue],
208
208
  .region.longitudeDelta = [regionDict[@"longitudeDelta"] doubleValue],
209
- .continuous = [dictionary[@"continuous"] boolValue],
209
+ .isGesture = [dictionary[@"isGesture"] boolValue],
210
210
  };
211
211
  mapViewEventEmitter->onRegionChange(data);
212
212
  }
@@ -339,12 +339,28 @@ using namespace facebook::react;
339
339
  .region.longitude = [regionDict[@"longitude"] doubleValue],
340
340
  .region.latitudeDelta = [regionDict[@"latitudeDelta"] doubleValue],
341
341
  .region.longitudeDelta = [regionDict[@"longitudeDelta"] doubleValue],
342
- .continuous = [dictionary[@"continuous"] boolValue],
342
+ .isGesture = [dictionary[@"isGesture"] boolValue],
343
343
  };
344
344
  mapViewEventEmitter->onRegionChangeStart(data);
345
345
  }
346
346
  };
347
347
 
348
+ _view.onRegionChangeComplete = [self](NSDictionary* dictionary) {
349
+ if (_eventEmitter) {
350
+
351
+ NSDictionary* regionDict = dictionary[@"region"];
352
+ auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
353
+ facebook::react::RNMapsMapViewEventEmitter::OnRegionChangeComplete data = {
354
+ .region.latitude = [regionDict[@"latitude"] doubleValue],
355
+ .region.longitude = [regionDict[@"longitude"] doubleValue],
356
+ .region.latitudeDelta = [regionDict[@"latitudeDelta"] doubleValue],
357
+ .region.longitudeDelta = [regionDict[@"longitudeDelta"] doubleValue],
358
+ .isGesture = [dictionary[@"isGesture"] boolValue],
359
+ };
360
+ mapViewEventEmitter->onRegionChangeComplete(data);
361
+ }
362
+ };
363
+
348
364
 
349
365
  #define HANDLE_MARKER_DRAG_EVENT(eventName, emitterFunction) \
350
366
  if (_eventEmitter) { \
@@ -33,8 +33,8 @@ RCT_EXPORT_VIEW_PROPERTY(onMarkerDrag, RCTDirectEventBlock)
33
33
  RCT_EXPORT_VIEW_PROPERTY(onMarkerDragEnd, RCTDirectEventBlock)
34
34
 
35
35
  RCT_EXPORT_VIEW_PROPERTY(onRegionChangeStart, RCTDirectEventBlock)
36
- RCT_EXPORT_VIEW_PROPERTY(onRegionChangeComplete, RCTDirectEventBlock)
37
36
  RCT_EXPORT_VIEW_PROPERTY(onRegionChange, RCTDirectEventBlock)
37
+ RCT_EXPORT_VIEW_PROPERTY(onRegionChangeComplete, RCTDirectEventBlock)
38
38
  RCT_EXPORT_VIEW_PROPERTY(onUserLocationChange, RCTDirectEventBlock)
39
39
 
40
40
 
@@ -17,7 +17,7 @@
17
17
  success:(RCTPromiseResolveBlock) success error:(RCTPromiseRejectBlock) error;
18
18
 
19
19
  - (NSDictionary *) getCameraDic;
20
- - (NSDictionary*) getMarkersFramesWithOnlyVisible:(BOOL)onlyVisible;
20
+ - (NSDictionary *) getMarkersFramesWithOnlyVisible:(BOOL)onlyVisible;
21
21
  - (NSDictionary *) getMapBoundaries;
22
22
  - (NSDictionary *) getPointForCoordinates:(CLLocationCoordinate2D) location;
23
23
  - (NSDictionary *) getCoordinatesForPoint:(CGPoint) point;
@@ -318,7 +318,7 @@ void RNMapsGoogleMapViewEventEmitter::onRegionChangeStart(OnRegionChangeStart $e
318
318
  region.setProperty(runtime, "longitudeDelta", $event.region.longitudeDelta);
319
319
  $payload.setProperty(runtime, "region", region);
320
320
  }
321
- $payload.setProperty(runtime, "continuous", $event.continuous);
321
+ $payload.setProperty(runtime, "isGesture", $event.isGesture);
322
322
  return $payload;
323
323
  });
324
324
  }
@@ -335,7 +335,7 @@ void RNMapsGoogleMapViewEventEmitter::onRegionChange(OnRegionChange $event) cons
335
335
  region.setProperty(runtime, "longitudeDelta", $event.region.longitudeDelta);
336
336
  $payload.setProperty(runtime, "region", region);
337
337
  }
338
- $payload.setProperty(runtime, "continuous", $event.continuous);
338
+ $payload.setProperty(runtime, "isGesture", $event.isGesture);
339
339
  return $payload;
340
340
  });
341
341
  }
@@ -352,7 +352,7 @@ void RNMapsGoogleMapViewEventEmitter::onRegionChangeComplete(OnRegionChangeCompl
352
352
  region.setProperty(runtime, "longitudeDelta", $event.region.longitudeDelta);
353
353
  $payload.setProperty(runtime, "region", region);
354
354
  }
355
- $payload.setProperty(runtime, "continuous", $event.continuous);
355
+ $payload.setProperty(runtime, "isGesture", $event.isGesture);
356
356
  return $payload;
357
357
  });
358
358
  }
@@ -730,7 +730,7 @@ void RNMapsMapViewEventEmitter::onRegionChangeStart(OnRegionChangeStart $event)
730
730
  region.setProperty(runtime, "longitudeDelta", $event.region.longitudeDelta);
731
731
  $payload.setProperty(runtime, "region", region);
732
732
  }
733
- $payload.setProperty(runtime, "continuous", $event.continuous);
733
+ $payload.setProperty(runtime, "isGesture", $event.isGesture);
734
734
  return $payload;
735
735
  });
736
736
  }
@@ -747,7 +747,7 @@ void RNMapsMapViewEventEmitter::onRegionChange(OnRegionChange $event) const {
747
747
  region.setProperty(runtime, "longitudeDelta", $event.region.longitudeDelta);
748
748
  $payload.setProperty(runtime, "region", region);
749
749
  }
750
- $payload.setProperty(runtime, "continuous", $event.continuous);
750
+ $payload.setProperty(runtime, "isGesture", $event.isGesture);
751
751
  return $payload;
752
752
  });
753
753
  }
@@ -764,7 +764,7 @@ void RNMapsMapViewEventEmitter::onRegionChangeComplete(OnRegionChangeComplete $e
764
764
  region.setProperty(runtime, "longitudeDelta", $event.region.longitudeDelta);
765
765
  $payload.setProperty(runtime, "region", region);
766
766
  }
767
- $payload.setProperty(runtime, "continuous", $event.continuous);
767
+ $payload.setProperty(runtime, "isGesture", $event.isGesture);
768
768
  return $payload;
769
769
  });
770
770
  }
@@ -245,7 +245,7 @@ class RNMapsGoogleMapViewEventEmitter : public ViewEventEmitter {
245
245
 
246
246
  struct OnRegionChangeStart {
247
247
  OnRegionChangeStartRegion region;
248
- bool continuous;
248
+ bool isGesture;
249
249
  };
250
250
 
251
251
  struct OnRegionChangeRegion {
@@ -257,7 +257,7 @@ class RNMapsGoogleMapViewEventEmitter : public ViewEventEmitter {
257
257
 
258
258
  struct OnRegionChange {
259
259
  OnRegionChangeRegion region;
260
- bool continuous;
260
+ bool isGesture;
261
261
  };
262
262
 
263
263
  struct OnRegionChangeCompleteRegion {
@@ -269,7 +269,7 @@ class RNMapsGoogleMapViewEventEmitter : public ViewEventEmitter {
269
269
 
270
270
  struct OnRegionChangeComplete {
271
271
  OnRegionChangeCompleteRegion region;
272
- bool continuous;
272
+ bool isGesture;
273
273
  };
274
274
 
275
275
  struct OnUserLocationChangeCoordinate {
@@ -593,7 +593,7 @@ class RNMapsMapViewEventEmitter : public ViewEventEmitter {
593
593
 
594
594
  struct OnRegionChangeStart {
595
595
  OnRegionChangeStartRegion region;
596
- bool continuous;
596
+ bool isGesture;
597
597
  };
598
598
 
599
599
  struct OnRegionChangeRegion {
@@ -605,7 +605,7 @@ class RNMapsMapViewEventEmitter : public ViewEventEmitter {
605
605
 
606
606
  struct OnRegionChange {
607
607
  OnRegionChangeRegion region;
608
- bool continuous;
608
+ bool isGesture;
609
609
  };
610
610
 
611
611
  struct OnRegionChangeCompleteRegion {
@@ -617,7 +617,7 @@ class RNMapsMapViewEventEmitter : public ViewEventEmitter {
617
617
 
618
618
  struct OnRegionChangeComplete {
619
619
  OnRegionChangeCompleteRegion region;
620
- bool continuous;
620
+ bool isGesture;
621
621
  };
622
622
 
623
623
  struct OnUserLocationChangeCoordinate {
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "main": "src/index.ts",
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.24.5",
8
+ "version": "1.24.7",
9
9
  "license": "MIT",
10
10
  "scripts": {
11
11
  "lint": "eslint . --max-warnings 0",
package/src/MapView.tsx CHANGED
@@ -448,7 +448,7 @@ export type MapViewProps = ViewProps & {
448
448
  * @platform iOS: Supported
449
449
  * @platform Android: Supported
450
450
  */
451
- onRegionChangeStart?: (event: NativeSyntheticEvent<Details>) => void;
451
+ onRegionChangeStart?: (region: Region, details: Details) => void;
452
452
 
453
453
  /**
454
454
  * Callback that is called continuously when the region changes, such as when a user is dragging the map.
@@ -765,7 +765,6 @@ class MapView extends React.Component<MapViewProps, State> {
765
765
  };
766
766
 
767
767
  this._onMapReady = this._onMapReady.bind(this);
768
- this._onChange = this._onChange.bind(this);
769
768
  }
770
769
 
771
770
  setNativeProps(props: Partial<NativeProps>) {
@@ -782,19 +781,6 @@ class MapView extends React.Component<MapViewProps, State> {
782
781
  });
783
782
  }
784
783
 
785
- private _onChange({nativeEvent}: ChangeEvent) {
786
- const isGesture = nativeEvent.isGesture;
787
- const details = {isGesture};
788
-
789
- if (nativeEvent.continuous) {
790
- if (this.props.onRegionChange) {
791
- this.props.onRegionChange(nativeEvent.region, details);
792
- }
793
- } else if (this.props.onRegionChangeComplete) {
794
- this.props.onRegionChangeComplete(nativeEvent.region, details);
795
- }
796
- }
797
-
798
784
  getCamera(): Promise<Camera> {
799
785
  if (this.fabricMap.current) {
800
786
  return this.fabricMap.current.getCamera();
@@ -1076,19 +1062,17 @@ class MapView extends React.Component<MapViewProps, State> {
1076
1062
  }
1077
1063
  };
1078
1064
  private handleRegionChange = (event: NativeSyntheticEvent<any>) => {
1079
- const isGesture = event.nativeEvent.isGesture;
1080
- const details = {isGesture};
1081
- if (event.nativeEvent.continuous) {
1082
- if (this.props.onRegionChange) {
1083
- this.props.onRegionChange(event.nativeEvent.region, details);
1084
- }
1085
- } else if (this.props.onRegionChangeComplete) {
1086
- this.props.onRegionChangeComplete(event.nativeEvent.region, details);
1065
+ if (this.props.onRegionChange) {
1066
+ this.props.onRegionChange(event.nativeEvent.region, {
1067
+ isGesture: event.nativeEvent.isGesture,
1068
+ });
1087
1069
  }
1088
1070
  };
1089
1071
  private handleRegionChangeStarted = (event: NativeSyntheticEvent<any>) => {
1090
1072
  if (this.props.onRegionChangeStart) {
1091
- this.props.onRegionChangeStart(event);
1073
+ this.props.onRegionChangeStart(event.nativeEvent.region, {
1074
+ isGesture: event.nativeEvent.isGesture,
1075
+ });
1092
1076
  }
1093
1077
  };
1094
1078
 
@@ -1108,10 +1092,10 @@ class MapView extends React.Component<MapViewProps, State> {
1108
1092
  };
1109
1093
 
1110
1094
  private handleRegionChangeComplete = (event: NativeSyntheticEvent<any>) => {
1111
- const isGesture = event.nativeEvent.isGesture;
1112
- const details = {isGesture};
1113
1095
  if (this.props.onRegionChangeComplete) {
1114
- this.props.onRegionChangeComplete(event.nativeEvent.region, details);
1096
+ this.props.onRegionChangeComplete(event.nativeEvent.region, {
1097
+ isGesture: event.nativeEvent.isGesture,
1098
+ });
1115
1099
  }
1116
1100
  };
1117
1101
 
@@ -148,7 +148,6 @@ export type UserLocationChangeEvent = NativeSyntheticEvent<{
148
148
  }>;
149
149
 
150
150
  export type ChangeEvent = NativeSyntheticEvent<{
151
- continuous: boolean;
152
151
  region: Region;
153
152
  isGesture?: boolean;
154
153
  }>;