Mapbox Implementation
Mapbox
Mapbox Version
"@rnmapbox/maps": "^10.1.30",
React Native Version
"react-native": "0.74.2",
Platform
Android
@rnmapbox/maps version
10.1.30
Standalone component to reproduce
<MapboxGL.MapView style={{ flex: 1 }}>
<MapboxGL.Camera
zoomLevel={20}
centerCoordinate={[78.486671,17.385044]} // Example coords
followUserLocation={followLocation}
/>
{showUserLocation && (
<MapboxGL.UserLocation
visible={true}
androidRenderMode="normal"
/>
)}
</MapboxGL.MapView>
// Stop location updates on unmount
useEffect(() => {
return () => {
stopLocation();
};
}, []);
// Handle Android back press
useEffect(() => {
const backHandler = BackHandler.addEventListener('hardwareBackPress', () => {
stopLocation();
navigation.goBack();
return true;
});
return () => backHandler.remove();
}, []);
const stopLocation = () => {
if (!hasStoppedRef.current) {
hasStoppedRef.current = true;
setShowUserLocation(false);
setFollowLocation(false);
MapboxGL.locationManager.stop();
}
};
useEffect(() => {
if (isFocused && !hasStartedRef.current) {
MapboxGL.locationManager.start();
hasStartedRef.current = true;
setShowUserLocation(true);
setFollowLocation(true);
}
}, [isFocused]);
Observed behavior and steps to reproduce
I am stopping the location but it is not stopping and the location icon is still visible in the status bar continuously fetching
Expected behavior
When click on any back button I am going back to previous screens I want to stop the live location and the location icon should be gone
Notes / preliminary analysis
No response
Additional links and references
No response
Mapbox Implementation
Mapbox
Mapbox Version
"@rnmapbox/maps": "^10.1.30",
React Native Version
Platform
Android
@rnmapbox/mapsversion10.1.30
Standalone component to reproduce
Observed behavior and steps to reproduce
I am stopping the location but it is not stopping and the location icon is still visible in the status bar continuously fetching
Expected behavior
When click on any back button I am going back to previous screens I want to stop the live location and the location icon should be gone
Notes / preliminary analysis
No response
Additional links and references
No response