File tree 1 file changed +6
-3
lines changed
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,9 @@ @interface AIRMapManager() <MKMapViewDelegate>
37
37
38
38
@end
39
39
40
- @implementation AIRMapManager
40
+ @implementation AIRMapManager {
41
+ BOOL _hasObserver;
42
+ }
41
43
42
44
RCT_EXPORT_MODULE ()
43
45
@@ -704,11 +706,12 @@ - (void)mapView:(AIRMap *)mapView
704
706
if (mapView.onMarkerDragEnd ) mapView.onMarkerDragEnd (event);
705
707
if (marker.onDragEnd ) marker.onDragEnd (event);
706
708
707
- [view removeObserver: self forKeyPath: @" center" ];
709
+ if (_hasObserver) [view removeObserver: self forKeyPath: @" center" ];
710
+ _hasObserver = NO ;
708
711
} else if (newState == MKAnnotationViewDragStateStarting) {
709
712
// MapKit doesn't emit continuous drag events. To get around this, we are going to use KVO.
710
713
[view addObserver: self forKeyPath: @" center" options: NSKeyValueObservingOptionNew context: &kDragCenterContext ];
711
-
714
+ _hasObserver = YES ;
712
715
if (mapView.onMarkerDragStart ) mapView.onMarkerDragStart (event);
713
716
if (marker.onDragStart ) marker.onDragStart (event);
714
717
}
You can’t perform that action at this time.
0 commit comments