Skip to content

Commit

Permalink
fix bug with distance not zeroing, adjust store to type changes
Browse files Browse the repository at this point in the history
  • Loading branch information
CDFN committed Apr 23, 2024
1 parent 9dbec7f commit 4d89a79
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/frontend/hooks/tracks/useCurrentTrackStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ export const useCurrentTrackStore = create<TracksStoreState>(set => ({
clearCurrentTrack: () =>
set(() => ({
locationHistory: [],
trackingSince: new Date(0),
trackingSince: null,
distance: 0,
isTracking: false,
observations: [],
})),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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) {
Expand All @@ -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,
Expand Down

0 comments on commit 4d89a79

Please sign in to comment.