diff --git a/src/screens/Settings/PIN/AskForBiometrics.tsx b/src/screens/Settings/PIN/AskForBiometrics.tsx index 7c8c96229..572991681 100644 --- a/src/screens/Settings/PIN/AskForBiometrics.tsx +++ b/src/screens/Settings/PIN/AskForBiometrics.tsx @@ -65,14 +65,21 @@ const AskForBiometrics = ({ const onSkip = (): void => { const bioType = biometryData?.biometryType ?? 'Biometrics'; - navigation.navigate('Result', { bio: false, type: bioType }); + // use navigation.reset to prevent user from going back to previous screen + navigation.reset({ + index: 0, + routes: [{ name: 'Result', params: { bio: false, type: bioType } }], + }); }; const onContinue = useCallback((): void => { const bioType = biometryData?.biometryType ?? 'Biometrics'; if (!biometryData?.available || !shouldEnableBiometrics) { - navigation.navigate('Result', { bio: false, type: bioType }); + navigation.reset({ + index: 0, + routes: [{ name: 'Result', params: { bio: false, type: bioType } }], + }); return; } @@ -81,7 +88,10 @@ const AskForBiometrics = ({ .then(({ success }) => { if (success) { dispatch(updateSettings({ biometrics: true })); - navigation.navigate('Result', { bio: true, type: bioType }); + navigation.reset({ + index: 0, + routes: [{ name: 'Result', params: { bio: true, type: bioType } }], + }); } }) .catch(() => { @@ -103,7 +113,10 @@ const AskForBiometrics = ({ return ( - + {!biometryData && {t('bio_loading')}} diff --git a/src/screens/Settings/PIN/ChoosePIN.tsx b/src/screens/Settings/PIN/ChoosePIN.tsx index 774785a08..a438978a8 100644 --- a/src/screens/Settings/PIN/ChoosePIN.tsx +++ b/src/screens/Settings/PIN/ChoosePIN.tsx @@ -65,7 +65,11 @@ const ChoosePIN = ({ if (pinsAreEqual) { addPin(pin); dispatch(hideTodo(pinTodo.id)); - navigation.navigate('AskForBiometrics'); + // replace the navigation stack to avoid going back to the PIN screen + navigation.reset({ + index: 0, + routes: [{ name: 'AskForBiometrics' }], + }); } else { vibrate({ type: 'notificationWarning' }); setPin('');