diff --git a/packages/kit/src/views/Account/AddNewAccount/Authentication.tsx b/packages/kit/src/views/Account/AddNewAccount/Authentication.tsx index f11608eced3..ccab870de22 100644 --- a/packages/kit/src/views/Account/AddNewAccount/Authentication.tsx +++ b/packages/kit/src/views/Account/AddNewAccount/Authentication.tsx @@ -1,7 +1,6 @@ /* eslint-disable react-hooks/exhaustive-deps */ import React, { FC, useEffect } from 'react'; -import { useNavigation } from '@react-navigation/core'; import { RouteProp, useRoute } from '@react-navigation/native'; import { Center, Modal, Spinner } from '@onekeyhq/components'; @@ -10,7 +9,6 @@ import { CreateAccountModalRoutes, CreateAccountRoutesParams, } from '@onekeyhq/kit/src/routes'; -import { ModalScreenProps } from '@onekeyhq/kit/src/routes/types'; export type EnableLocalAuthenticationProps = { password: string; @@ -37,12 +35,10 @@ const HDAccountAuthenticationDone: FC = ({ ); }; -type NavigationProps = ModalScreenProps; export const HDAccountAuthentication: FC = () => { const route = useRoute(); const { onDone } = route.params; - const navigation = useNavigation(); return ( @@ -51,7 +47,6 @@ export const HDAccountAuthentication: FC = () => { password={password} onDone={() => { onDone(password); - navigation?.goBack(); }} /> )} diff --git a/packages/kit/src/views/Account/AddNewAccount/RecoverAccounts.tsx b/packages/kit/src/views/Account/AddNewAccount/RecoverAccounts.tsx index 14c5c200b19..ae38c25aa61 100644 --- a/packages/kit/src/views/Account/AddNewAccount/RecoverAccounts.tsx +++ b/packages/kit/src/views/Account/AddNewAccount/RecoverAccounts.tsx @@ -32,11 +32,7 @@ import { CreateAccountModalRoutes, CreateAccountRoutesParams, } from '@onekeyhq/kit/src/routes'; -import { - ModalRoutes, - ModalScreenProps, - RootRoutes, -} from '@onekeyhq/kit/src/routes/types'; +import { ModalScreenProps } from '@onekeyhq/kit/src/routes/types'; type NavigationProps = ModalScreenProps; @@ -202,30 +198,18 @@ const RecoverAccounts: FC = () => { id: 'account__recover_Step_1_of_2', })}`} onBackActionPress={() => { - navigation.navigate(RootRoutes.Modal, { - screen: ModalRoutes.CreateAccount, - params: { - screen: CreateAccountModalRoutes.CreateAccountForm, - params: { - walletId, - }, - }, + navigation.navigate(CreateAccountModalRoutes.CreateAccountForm, { + walletId, }); }} primaryActionTranslationId="action__next" onPrimaryActionPress={() => { - navigation.navigate(RootRoutes.Modal, { - screen: ModalRoutes.CreateAccount, - params: { - screen: CreateAccountModalRoutes.RecoverAccountsConfirm, - params: { - accounts: [ - ...flatListData.filter((i) => !i.isDisabled && i.selected), - ], - walletId, - network, - }, - }, + navigation.navigate(CreateAccountModalRoutes.RecoverAccountsConfirm, { + accounts: [ + ...flatListData.filter((i) => !i.isDisabled && i.selected), + ], + walletId, + network, }); }} primaryActionProps={{ diff --git a/packages/kit/src/views/Account/AddNewAccount/index.tsx b/packages/kit/src/views/Account/AddNewAccount/index.tsx index 19b1f404311..bbdd8951ee7 100644 --- a/packages/kit/src/views/Account/AddNewAccount/index.tsx +++ b/packages/kit/src/views/Account/AddNewAccount/index.tsx @@ -15,11 +15,7 @@ import { CreateAccountModalRoutes, CreateAccountRoutesParams, } from '@onekeyhq/kit/src/routes'; -import { - ModalRoutes, - ModalScreenProps, - RootRoutes, -} from '@onekeyhq/kit/src/routes/types'; +import { ModalScreenProps } from '@onekeyhq/kit/src/routes/types'; type PrivateKeyFormValues = { network: string; @@ -85,7 +81,6 @@ const CreateAccount: FC = ({ onClose }) => { title: intl.formatMessage({ id: errorKey }), }); } - closeDrawer(); if (navigation.canGoBack()) { navigation.getParent()?.goBack?.(); @@ -96,14 +91,10 @@ const CreateAccount: FC = ({ onClose }) => { ); const onSubmit = handleSubmit(() => { - navigation.navigate(RootRoutes.Modal, { - screen: ModalRoutes.CreateAccount, - params: { - screen: CreateAccountModalRoutes.CreateAccountAuthentication, - params: { - onDone: authenticationDone, - }, - }, + console.log('onSubmit'); + + navigation.navigate(CreateAccountModalRoutes.CreateAccountAuthentication, { + onDone: authenticationDone, }); }); @@ -145,30 +136,18 @@ const CreateAccount: FC = ({ onClose }) => { { - navigation.navigate(RootRoutes.Modal, { - screen: ModalRoutes.CreateAccount, - params: { - screen: - CreateAccountModalRoutes.CreateAccountAuthentication, - params: { - onDone: (password) => { - const network = getValues('network'); - navigation.navigate(RootRoutes.Modal, { - screen: ModalRoutes.CreateAccount, - params: { - screen: - CreateAccountModalRoutes.RecoverAccountsList, - params: { - walletId: selectedWalletId, - network, - password, - }, - }, - }); - }, + navigation.navigate( + CreateAccountModalRoutes.CreateAccountAuthentication, + { + onDone: (password) => { + const network = getValues('network'); + navigation.navigate( + CreateAccountModalRoutes.RecoverAccountsList, + { walletId: selectedWalletId, network, password }, + ); }, }, - }); + ); }} >