diff --git a/src/frontend/hooks/tracks/useCurrentTrackStore.ts b/src/frontend/hooks/tracks/useCurrentTrackStore.ts index efd13cd00..9d74d6124 100644 --- a/src/frontend/hooks/tracks/useCurrentTrackStore.ts +++ b/src/frontend/hooks/tracks/useCurrentTrackStore.ts @@ -57,7 +57,8 @@ export const useCurrentTrackStore = create(set => ({ clearCurrentTrack: () => set(() => ({ locationHistory: [], - trackingSince: new Date(0), + trackingSince: null, + distance: 0, isTracking: false, observations: [], })), diff --git a/src/frontend/screens/MapScreen/GPSPermissions/GPSPermissionsEnabled.tsx b/src/frontend/screens/MapScreen/GPSPermissions/GPSPermissionsEnabled.tsx index 647794dca..1aecf7e4d 100644 --- a/src/frontend/screens/MapScreen/GPSPermissions/GPSPermissionsEnabled.tsx +++ b/src/frontend/screens/MapScreen/GPSPermissions/GPSPermissionsEnabled.tsx @@ -7,8 +7,8 @@ import StartTrackingIcon from '../../../images/StartTracking.svg'; import StopTrackingIcon from '../../../images/StopTracking.svg'; import {useTrackTimerContext} from '../../../contexts/TrackTimerContext'; import {defineMessages, useIntl} from 'react-intl'; -import {useNavigation} from '@react-navigation/native'; import {useCurrentTrackStore} from '../../../hooks/tracks/useCurrentTrackStore'; +import {useNavigationFromHomeTabs} from '../../../hooks/useNavigationWithTypes'; const m = defineMessages({ defaultButtonText: { @@ -38,7 +38,7 @@ export const GPSPermissionsEnabled = () => { ); const {timer} = useTrackTimerContext(); const styles = getStyles(isTracking); - const navigation = useNavigation(); + const navigation = useNavigationFromHomeTabs(); const handleTracking = useCallback(() => { if (!isTracking) { @@ -50,9 +50,9 @@ export const GPSPermissionsEnabled = () => { if (locationHistory.length <= 1) { clearCurrentTrack(); - navigation.navigate('Home' as never); + navigation.navigate('Map'); } else { - navigation.navigate('SaveTrack' as never); + navigation.navigate('SaveTrack'); } }, [ cancelTracking,