diff --git a/src/navigation/onboarding/OnboardingNavigator.tsx b/src/navigation/onboarding/OnboardingNavigator.tsx index 5aacd2a97..7b5865326 100644 --- a/src/navigation/onboarding/OnboardingNavigator.tsx +++ b/src/navigation/onboarding/OnboardingNavigator.tsx @@ -13,6 +13,7 @@ import CreateWallet, { import { NavigationContainer } from '../../styles/components'; import { useAppSelector } from '../../hooks/redux'; import { requiresRemoteRestoreSelector } from '../../store/reselect/user'; +import { walletExistsSelector } from '../../store/reselect/wallet'; export type OnboardingStackParamList = { TermsOfUse: undefined; @@ -38,13 +39,15 @@ const navOptionHandlerNoBack = { const OnboardingNavigator = (): ReactElement => { const requiresRemoteRestore = useAppSelector(requiresRemoteRestoreSelector); + const walletExists = useAppSelector(walletExistsSelector); + + // If a wallet exists but remote LDK revocery is not complete, show the CreateWallet screen + const initialRouteName = + walletExists && requiresRemoteRestore ? 'CreateWallet' : 'TermsOfUse'; return ( - + ): ReactElement => { const skipIntro = route.params?.skipIntro ?? false; const bip39Passphrase = route.params?.bip39Passphrase; + const dispatch = useAppDispatch(); const dimensions = useWindowDimensions(); const { t } = useTranslation('onboarding'); const ref = useRef(null); @@ -169,11 +172,12 @@ const Slideshow = ({ }; const onCreateWallet = useCallback(async (): Promise => { + dispatch(updateUser({ requiresRemoteRestore: false })); navigation.navigate('CreateWallet', { action: 'create', bip39Passphrase, }); - }, [bip39Passphrase, navigation]); + }, [bip39Passphrase, dispatch, navigation]); const onRestoreWallet = (): void => { navigation.navigate('MultipleDevices');