diff --git a/native/account/registration/auth-navigator.react.js b/native/account/registration/auth-navigator.react.js --- a/native/account/registration/auth-navigator.react.js +++ b/native/account/registration/auth-navigator.react.js @@ -136,6 +136,11 @@ }, }; +const disableGesturesScreenOptions = { + headerLeft: null, + gestureEnabled: false, +}; + const cameraScreenOptions = { headerShown: false, }; @@ -216,6 +221,7 @@ <Auth.Screen name={RestoreBackupScreenRouteName} component={RestoreBackupScreen} + options={disableGesturesScreenOptions} /> <Auth.Screen name={RestoreSIWEBackupRouteName} diff --git a/native/account/restore-backup-screen.react.js b/native/account/restore-backup-screen.react.js --- a/native/account/restore-backup-screen.react.js +++ b/native/account/restore-backup-screen.react.js @@ -13,6 +13,7 @@ import type { AuthNavigationProp } from './registration/auth-navigator.react.js'; import { useRestore } from './restore.js'; import { commCoreModule } from '../native-modules.js'; +import { logInActionType } from '../navigation/action-types.js'; import type { NavigationRoute } from '../navigation/route-names.js'; import { useColors, useStyles } from '../themes/colors.js'; import { @@ -49,6 +50,11 @@ const restore = useRestore(); React.useEffect(() => { + const removeListener = props.navigation.addListener('beforeRemove', e => { + if (e.data.action.type !== logInActionType) { + e.preventDefault(); + } + }); void (async () => { try { if (credentials.type === 'password') { @@ -66,6 +72,7 @@ ); } } catch (e) { + removeListener(); const messageForException = getMessageForException(e); console.log( `Backup restore error: ${messageForException ?? 'unknown error'}`, @@ -91,6 +98,7 @@ ); } })(); + return removeListener; // We want this effect to run exactly once // eslint-disable-next-line react-hooks/exhaustive-deps }, []);