diff --git a/dev-client/src/screens/BottomTabsScreen.tsx b/dev-client/src/screens/BottomTabsScreen.tsx index 2e9835452..33897071e 100644 --- a/dev-client/src/screens/BottomTabsScreen.tsx +++ b/dev-client/src/screens/BottomTabsScreen.tsx @@ -78,6 +78,8 @@ export const BottomTabsScreen = memo(() => { locationManager.addListener(listener); return () => locationManager.removeListener(listener); + } else { + dispatch(updateLocation({coords: null, accuracyM: null})); } }, [dispatch, locationPermissions?.granted]); diff --git a/dev-client/src/screens/SitesScreen/SitesScreen.tsx b/dev-client/src/screens/SitesScreen/SitesScreen.tsx index 3c60aa71b..0ca0a1775 100644 --- a/dev-client/src/screens/SitesScreen/SitesScreen.tsx +++ b/dev-client/src/screens/SitesScreen/SitesScreen.tsx @@ -98,7 +98,9 @@ export const SitesScreen = memo(() => { } }, [dispatch, currentUserID]); - const currentUserCoords = useSelector(state => state.map.userLocation.coords); + const currentUserCoords = useSelector( + state => state.map.userLocation?.coords, + ); const [finishedLoading, setFinishedLoading] = useState(false); const [finishedInitialCameraMove, setFinishedInitialCameraMove] = diff --git a/dev-client/src/screens/SitesScreen/components/CustomUserLocation.tsx b/dev-client/src/screens/SitesScreen/components/CustomUserLocation.tsx index 34eed0f46..ceeb73aba 100644 --- a/dev-client/src/screens/SitesScreen/components/CustomUserLocation.tsx +++ b/dev-client/src/screens/SitesScreen/components/CustomUserLocation.tsx @@ -55,6 +55,7 @@ export const CustomUserLocation = ({ const userLocation = useSelector(state => state.map.userLocation); const feature = useMemo(() => { + // Coords should be null when permissions are not granted if (userLocation.coords === null) { return null; }