Updated Show Map example to follow user location

This commit is contained in:
Nick
2017-10-23 16:41:53 -07:00
parent 123d841d90
commit ca459dc07a
2 changed files with 4 additions and 1 deletions
@@ -441,7 +441,9 @@ public class RCTMGLMapView extends MapView implements
mLocationEngine.requestLocationUpdates();
Location location = mLocationEngine.getLastLocation();
if (location != null) {
int trackingMode = getLocationLayerTrackingMode();
if (location != null && trackingMode != LocationLayerMode.NONE) {
LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
}
+1
View File
@@ -38,6 +38,7 @@ class ShowMap extends React.Component {
<TabBarPage {...this.props} scrollable options={this._mapOptions} onOptionPress={this.onMapChange}>
<MapboxGL.MapView
showUserLocation={true}
userTrackingMode={MapboxGL.UserTrackingModes.Follow}
styleURL={this.state.styleURL}
style={sheet.matchParent} />
</TabBarPage>