[ReactNative] Fix RCTMapManager retaining cycle
This commit is contained in:
parent
6299803081
commit
e714ba15a5
|
@ -2,6 +2,7 @@
|
|||
|
||||
#import "RCTMap.h"
|
||||
|
||||
#import "RCTConvert.h"
|
||||
#import "RCTEventDispatcher.h"
|
||||
#import "RCTLog.h"
|
||||
#import "RCTUtils.h"
|
||||
|
@ -90,18 +91,9 @@ const CGFloat RCTMapZoomBoundBuffer = 0.01;
|
|||
{
|
||||
if (region) {
|
||||
MKCoordinateRegion coordinateRegion = self.region;
|
||||
if ([region[@"latitude"] isKindOfClass:[NSNumber class]]) {
|
||||
coordinateRegion.center.latitude = [region[@"latitude"] doubleValue];
|
||||
} else {
|
||||
RCTLogError(@"region must include numeric latitude, got: %@", region);
|
||||
return;
|
||||
}
|
||||
if ([region[@"longitude"] isKindOfClass:[NSNumber class]]) {
|
||||
coordinateRegion.center.longitude = [region[@"longitude"] doubleValue];
|
||||
} else {
|
||||
RCTLogError(@"region must include numeric longitude, got: %@", region);
|
||||
return;
|
||||
}
|
||||
coordinateRegion.center.latitude = [RCTConvert double:region[@"latitude"]];
|
||||
coordinateRegion.center.longitude = [RCTConvert double:region[@"longitude"]];
|
||||
|
||||
if ([region[@"latitudeDelta"] isKindOfClass:[NSNumber class]]) {
|
||||
coordinateRegion.span.latitudeDelta = [region[@"latitudeDelta"] doubleValue];
|
||||
}
|
||||
|
|
|
@ -60,11 +60,11 @@ RCT_REMAP_VIEW_PROPERTY(region, JSONRegion)
|
|||
|
||||
- (void)mapView:(RCTMap *)mapView regionDidChangeAnimated:(BOOL)animated
|
||||
{
|
||||
[self _regionChanged:mapView];
|
||||
[self _emitRegionChangeEvent:mapView continuous:NO];
|
||||
|
||||
[mapView.regionChangeObserveTimer invalidate];
|
||||
mapView.regionChangeObserveTimer = nil;
|
||||
|
||||
[self _regionChanged:mapView];
|
||||
[self _emitRegionChangeEvent:mapView continuous:NO];
|
||||
}
|
||||
|
||||
#pragma mark Private
|
||||
|
|
Loading…
Reference in New Issue