mirror of
https://github.com/status-im/react-native-mapbox-gl.git
synced 2026-08-30 20:41:08 +00:00
Updated Show Map example to follow user location
This commit is contained in:
+3
-1
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user