Skip to content

Commit

Permalink
Set initial region on view (react-native-maps#1579)
Browse files Browse the repository at this point in the history
  • Loading branch information
petha authored and patricio committed Sep 27, 2017
1 parent 2c8ddfe commit 7b9ed3d
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions lib/ios/AirMaps/AIRMapManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,17 @@ - (UIView *)view
RCT_EXPORT_VIEW_PROPERTY(onMarkerDrag, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onMarkerDragEnd, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onCalloutPress, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(initialRegion, MKCoordinateRegion)
RCT_CUSTOM_VIEW_PROPERTY(initialRegion, MKCoordinateRegion, AIRMap)
{
if (json == nil) return;

// don't emit region change events when we are setting the initialRegion
BOOL originalIgnore = view.ignoreRegionChanges;
view.ignoreRegionChanges = YES;
[view setInitialRegion:[RCTConvert MKCoordinateRegion:json]];
view.ignoreRegionChanges = originalIgnore;
}

RCT_EXPORT_VIEW_PROPERTY(minZoomLevel, CGFloat)
RCT_EXPORT_VIEW_PROPERTY(maxZoomLevel, CGFloat)

Expand Down Expand Up @@ -665,7 +675,7 @@ - (void)mapViewDidFinishRenderingMap:(AIRMap *)mapView fullyRendered:(BOOL)fully
{
[mapView finishLoading];
[mapView cacheViewIfNeeded];

mapView.onMapReady(@{});
}

Expand Down

0 comments on commit 7b9ed3d

Please sign in to comment.