diff --git a/src/libs/actions/Session/index.ts b/src/libs/actions/Session/index.ts index 603950c4b139..9ee3bf38fc75 100644 --- a/src/libs/actions/Session/index.ts +++ b/src/libs/actions/Session/index.ts @@ -1304,7 +1304,6 @@ function resetSMSDeliveryFailureStatus(login: string) { value: { smsDeliveryFailureStatus: { isLoading: false, - isReset: true, }, }, }, diff --git a/src/pages/signin/SMSDeliveryFailurePage.tsx b/src/pages/signin/SMSDeliveryFailurePage.tsx index 953a0dfc0a8b..f27829a3b3f1 100644 --- a/src/pages/signin/SMSDeliveryFailurePage.tsx +++ b/src/pages/signin/SMSDeliveryFailurePage.tsx @@ -1,5 +1,5 @@ import {Str} from 'expensify-common'; -import React, {useEffect, useMemo} from 'react'; +import React, {useEffect, useMemo, useState} from 'react'; import {Keyboard, View} from 'react-native'; import {useOnyx} from 'react-native-onyx'; import Button from '@components/Button'; @@ -45,7 +45,8 @@ function SMSDeliveryFailurePage() { const hasSMSDeliveryFailure = account?.smsDeliveryFailureStatus?.hasSMSDeliveryFailure; - const isReset = account?.smsDeliveryFailureStatus?.isReset; + // We need to show two different messages after clicking validate button, based on API response for hasSMSDeliveryFailure. + const [hasClickedValidate, setHasClickedValidate] = useState(false); const errorText = useMemo(() => (account ? getLatestErrorMessage(account) : ''), [account]); const shouldShowError = !!errorText; @@ -57,7 +58,7 @@ function SMSDeliveryFailurePage() { Keyboard.dismiss(); }, [isKeyboardShown]); - if (hasSMSDeliveryFailure && isReset) { + if (hasSMSDeliveryFailure && hasClickedValidate) { return ( <> @@ -87,7 +88,7 @@ function SMSDeliveryFailurePage() { ); } - if (!hasSMSDeliveryFailure && isReset) { + if (!hasSMSDeliveryFailure && hasClickedValidate) { return ( <> @@ -126,7 +127,10 @@ function SMSDeliveryFailurePage() { resetSMSDeliveryFailureStatus(login)} + onSubmit={() => { + resetSMSDeliveryFailureStatus(login); + setHasClickedValidate(true); + }} message={errorText} isAlertVisible={shouldShowError} containerStyles={[styles.w100, styles.mh0]} diff --git a/src/types/onyx/Account.ts b/src/types/onyx/Account.ts index e09581577183..29d971163457 100644 --- a/src/types/onyx/Account.ts +++ b/src/types/onyx/Account.ts @@ -65,9 +65,6 @@ type SMSDeliveryFailureStatus = { /** The message associated with the SMS delivery failure */ message: string; - /** Indicates whether the SMS delivery failure status has been reset by an API call */ - isReset?: boolean; - /** Whether a sign is loading */ isLoading?: boolean; };