diff --git a/native/account/logged-out-modal.react.js b/native/account/logged-out-modal.react.js --- a/native/account/logged-out-modal.react.js +++ b/native/account/logged-out-modal.react.js @@ -240,6 +240,10 @@ +nextMode: LoggedOutMode, }; +export type LoggedOutModalParams = { + +mode?: ?LoggedOutMode, +}; + type Props = { +navigation: RootNavigationProp<'LoggedOutModal'>, +route: NavigationRoute<'LoggedOutModal'>, @@ -328,6 +332,14 @@ [setMode, modeValue], ); + React.useEffect(() => { + const navMode = props.route.params?.mode; + if (navMode) { + combinedSetMode(navMode); + props.navigation.setParams({ mode: null }); + } + }, [combinedSetMode, props.navigation, props.route.params?.mode]); + const goBackToPrompt = React.useCallback(() => { nextModeRef.current = 'prompt'; setMode({ nextMode: 'prompt' }); diff --git a/native/navigation/route-names.js b/native/navigation/route-names.js --- a/native/navigation/route-names.js +++ b/native/navigation/route-names.js @@ -4,6 +4,7 @@ import type { ActionResultModalParams } from './action-result-modal.react.js'; import type { InviteLinkModalParams } from './invite-link-modal.react'; +import type { LoggedOutModalParams } from '../account/logged-out-modal.react'; import type { AvatarSelectionParams } from '../account/registration/avatar-selection.react.js'; import type { ConnectEthereumParams } from '../account/registration/connect-ethereum.react.js'; import type { ConnectFarcasterParams } from '../account/registration/connect-farcaster.react.js'; @@ -176,7 +177,7 @@ export const NUXTipOverlayBackdropRouteName = 'NUXTipOverlayBackdrop'; export type RootParamList = { - +LoggedOutModal: void, + +LoggedOutModal: LoggedOutModalParams, +App: void, +ThreadPickerModal: ThreadPickerModalParams, +AddUsersModal: AddUsersModalParams, diff --git a/native/qr-code/qr-code-screen.react.js b/native/qr-code/qr-code-screen.react.js --- a/native/qr-code/qr-code-screen.react.js +++ b/native/qr-code/qr-code-screen.react.js @@ -13,6 +13,7 @@ import type { QRCodeSignInNavigationProp } from './qr-code-sign-in-navigator.react.js'; import LinkButton from '../components/link-button.react.js'; import type { NavigationRoute } from '../navigation/route-names.js'; +import { LoggedOutModalRouteName } from '../navigation/route-names.js'; import { useStyles } from '../themes/colors.js'; type QRCodeScreenProps = { @@ -20,7 +21,6 @@ +route: NavigationRoute<'QRCodeScreen'>, }; -// eslint-disable-next-line no-unused-vars function QRCodeScreen(props: QRCodeScreenProps): React.Node { const { qrData, generateQRCode } = useQRAuthContext(); @@ -40,11 +40,20 @@ const styles = useStyles(unboundStyles); + const goToRestoreFlow = React.useCallback(() => { + props.navigation.navigate(LoggedOutModalRouteName, { + mode: 'restore', + }); + }, [props.navigation]); + let primaryRestoreButton = null; if (usingRestoreFlow) { primaryRestoreButton = ( - {}} /> + ); }