diff --git a/src/Settings/WalletSettingsScreen.tsx b/src/Settings/WalletSettingsScreen.tsx index 894f7abd10..d3251413d8 100644 --- a/src/Settings/WalletSettingsScreen.tsx +++ b/src/Settings/WalletSettingsScreen.tsx @@ -1,4 +1,5 @@ import {useNavigation} from '@react-navigation/native' +import {CommonActions} from '@react-navigation/routers' import React from 'react' import type {MessageDescriptor} from 'react-intl' import {defineMessages, useIntl} from 'react-intl' @@ -15,7 +16,7 @@ import { SettingsSection, } from '../../legacy/components/Settings/SettingsItems' import {StatusBar} from '../../legacy/components/UiKit' -import {isByron, isHaskellShelley} from '../../legacy/config/config' +import {CONFIG, isByron, isHaskellShelley} from '../../legacy/config/config' import {getNetworkConfigById} from '../../legacy/config/networks' import type {NetworkId, WalletImplementationId} from '../../legacy/config/types' import walletManager from '../../legacy/crypto/walletManager' @@ -248,6 +249,8 @@ const LogoutButton = () => { return } +const rootRoute = __DEV__ && CONFIG.DEBUG.START_WITH_INDEX_SCREEN ? 'screens-index' : 'app-root' + const useResync = (options?: UseMutationOptions) => { const intl = useIntl() const navigation = useNavigation() @@ -260,8 +263,13 @@ const useResync = (options?: UseMutationOptions) => { resyncWithConfirmation: async () => { const selection = await showConfirmationDialog(confirmationMessages.resync, intl) if (selection === DIALOG_BUTTONS.YES) { - navigation.goBack() - navigation.goBack() + navigation.dispatch( + CommonActions.reset({ + index: 0, + routes: [{name: rootRoute}], + }), + ) + navigation.navigate(rootRoute) setTimeout(() => mutation.mutate(), 1000) // wait for navigation to finish } },