mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 04:16:00 +08:00
Map follow user location
Summary: Fix #3105 It's the same PR as #3119 but as I force-pushed in my branch, I can't reopen the PR. I added an example.  Closes https://github.com/facebook/react-native/pull/5126 Reviewed By: svcscm Differential Revision: D2803052 Pulled By: nicklockwood fb-gh-sync-id: 2e8978ff1b293d699462a8290b45fa74cc16b4dd
This commit is contained in:
committed by
facebook-github-bot-5
parent
61025a9b33
commit
3d0ff69e40
@@ -100,10 +100,6 @@ const CGFloat RCTMapZoomBoundBuffer = 0.01;
|
||||
}
|
||||
}
|
||||
super.showsUserLocation = showsUserLocation;
|
||||
|
||||
// If it needs to show user location, force map view centered
|
||||
// on user's current location on user location updates
|
||||
_followUserLocation = showsUserLocation;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -85,6 +85,7 @@ RCT_EXPORT_MODULE()
|
||||
RCT_EXPORT_VIEW_PROPERTY(showsUserLocation, BOOL)
|
||||
RCT_EXPORT_VIEW_PROPERTY(showsPointsOfInterest, BOOL)
|
||||
RCT_EXPORT_VIEW_PROPERTY(showsCompass, BOOL)
|
||||
RCT_EXPORT_VIEW_PROPERTY(followUserLocation, BOOL)
|
||||
RCT_EXPORT_VIEW_PROPERTY(zoomEnabled, BOOL)
|
||||
RCT_EXPORT_VIEW_PROPERTY(rotateEnabled, BOOL)
|
||||
RCT_EXPORT_VIEW_PROPERTY(pitchEnabled, BOOL)
|
||||
@@ -320,9 +321,6 @@ RCT_CUSTOM_VIEW_PROPERTY(region, MKCoordinateRegion, RCTMap)
|
||||
region.span.longitudeDelta = RCTMapDefaultSpan;
|
||||
region.center = location.coordinate;
|
||||
[mapView setRegion:region animated:YES];
|
||||
|
||||
// Move to user location only for the first time it loads up.
|
||||
mapView.followUserLocation = NO;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user