From a0f382bb6239a9f242ff011aecc08585956ad5aa Mon Sep 17 00:00:00 2001 From: Wildan Muhlis Date: Thu, 14 Nov 2024 09:20:48 +0700 Subject: [PATCH] Fix ValidateCodeActionModal dismissed when re-connect --- .../Profile/Contacts/NewContactMethodPage.tsx | 132 +++++++++--------- 1 file changed, 67 insertions(+), 65 deletions(-) diff --git a/src/pages/settings/Profile/Contacts/NewContactMethodPage.tsx b/src/pages/settings/Profile/Contacts/NewContactMethodPage.tsx index 9d6f167fc04e..8f69663fb936 100644 --- a/src/pages/settings/Profile/Contacts/NewContactMethodPage.tsx +++ b/src/pages/settings/Profile/Contacts/NewContactMethodPage.tsx @@ -21,7 +21,7 @@ import Navigation from '@libs/Navigation/Navigation'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import {addSMSDomainIfPhoneNumber} from '@libs/PhoneNumber'; import * as UserUtils from '@libs/UserUtils'; -import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; +import NotFoundPage from '@pages/ErrorPage/NotFoundPage'; import * as User from '@userActions/User'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; @@ -109,72 +109,74 @@ function NewContactMethodPage({route}: NewContactMethodPageProps) { Navigation.goBack(ROUTES.SETTINGS_CONTACT_METHODS.getRoute(navigateBackTo)); }, [navigateBackTo]); + if (isActingAsDelegate) { + return ; + } + return ( - - loginInputRef.current?.focus()} - includeSafeAreaPaddingBottom={false} - shouldEnableMaxHeight - testID={NewContactMethodPage.displayName} + loginInputRef.current?.focus()} + includeSafeAreaPaddingBottom={false} + shouldEnableMaxHeight + testID={NewContactMethodPage.displayName} + > + + - - - {translate('common.pleaseEnterEmailOrPhoneNumber')} - - - - {hasFailedToSendVerificationCode && ( - - )} - - { - if (!loginData) { - return; - } - User.clearContactMethodErrors(addSMSDomainIfPhoneNumber(pendingContactAction?.contactMethod ?? contactMethod), 'addedLogin'); - }} - onClose={() => { - if (loginData?.errorFields && pendingContactAction?.contactMethod) { - User.clearContactMethod(pendingContactAction?.contactMethod); - User.clearUnvalidatedNewContactMethodAction(); - } - setIsValidateCodeActionModalVisible(false); - }} - isVisible={isValidateCodeActionModalVisible} - hasMagicCodeBeenSent={!!loginData?.validateCodeSent} - title={translate('delegate.makeSureItIsYou')} - sendValidateCode={() => User.requestValidateCodeAction()} - descriptionPrimary={translate('contacts.enterMagicCode', {contactMethod})} - /> - - + {translate('common.pleaseEnterEmailOrPhoneNumber')} + + + + {hasFailedToSendVerificationCode && ( + + )} + + { + if (!loginData) { + return; + } + User.clearContactMethodErrors(addSMSDomainIfPhoneNumber(pendingContactAction?.contactMethod ?? contactMethod), 'addedLogin'); + }} + onClose={() => { + if (loginData?.errorFields && pendingContactAction?.contactMethod) { + User.clearContactMethod(pendingContactAction?.contactMethod); + User.clearUnvalidatedNewContactMethodAction(); + } + setIsValidateCodeActionModalVisible(false); + }} + isVisible={isValidateCodeActionModalVisible} + hasMagicCodeBeenSent={!!loginData?.validateCodeSent} + title={translate('delegate.makeSureItIsYou')} + sendValidateCode={() => User.requestValidateCodeAction()} + descriptionPrimary={translate('contacts.enterMagicCode', {contactMethod})} + /> + ); }