From 6c6ed859a16016d47aed992023af8e4653f91516 Mon Sep 17 00:00:00 2001 From: Krishna Gupta Date: Sun, 17 Mar 2024 01:22:08 +0530 Subject: [PATCH] update according to all NAB suggestions. Signed-off-by: Krishna Gupta --- src/libs/actions/Session/index.ts | 8 ++++---- src/pages/LogInWithShortLivedAuthTokenPage.tsx | 4 ++-- src/pages/iou/request/step/IOURequestStepConfirmation.js | 7 ++++--- src/pages/iou/request/step/IOURequestStepParticipants.js | 6 +++--- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/libs/actions/Session/index.ts b/src/libs/actions/Session/index.ts index af01ab3ced4b..79d7b553e957 100644 --- a/src/libs/actions/Session/index.ts +++ b/src/libs/actions/Session/index.ts @@ -43,7 +43,7 @@ import * as Welcome from '@userActions/Welcome'; import CONFIG from '@src/CONFIG'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import type {HybridAppRoute, Route as Routes} from '@src/ROUTES'; +import type {HybridAppRoute, Route} from '@src/ROUTES'; import ROUTES from '@src/ROUTES'; import SCREENS from '@src/SCREENS'; import type Credentials from '@src/types/onyx/Credentials'; @@ -909,18 +909,18 @@ function waitForUserSignIn(): Promise { }); } -function handleExitToNavigation(exitTo: Routes | HybridAppRoute) { +function handleExitToNavigation(exitTo: Route | HybridAppRoute) { InteractionManager.runAfterInteractions(() => { waitForUserSignIn().then(() => { Navigation.waitForProtectedRoutes().then(() => { - const url = NativeModules.HybridAppModule ? Navigation.parseHybridAppUrl(exitTo) : (exitTo as Routes); + const url = NativeModules.HybridAppModule ? Navigation.parseHybridAppUrl(exitTo) : (exitTo as Route); Navigation.navigate(url); }); }); }); } -function signInWithValidateCodeAndNavigate(accountID: number, validateCode: string, twoFactorAuthCode = '', exitTo?: Routes | HybridAppRoute) { +function signInWithValidateCodeAndNavigate(accountID: number, validateCode: string, twoFactorAuthCode = '', exitTo?: Route | HybridAppRoute) { signInWithValidateCode(accountID, validateCode, twoFactorAuthCode); if (exitTo) { handleExitToNavigation(exitTo); diff --git a/src/pages/LogInWithShortLivedAuthTokenPage.tsx b/src/pages/LogInWithShortLivedAuthTokenPage.tsx index 5d01f1174f51..72425e0e2ca6 100644 --- a/src/pages/LogInWithShortLivedAuthTokenPage.tsx +++ b/src/pages/LogInWithShortLivedAuthTokenPage.tsx @@ -18,7 +18,7 @@ import type {PublicScreensParamList} from '@libs/Navigation/types'; import * as Session from '@userActions/Session'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import type {Route as Routes} from '@src/ROUTES'; +import type {Route} from '@src/ROUTES'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; import type {Account} from '@src/types/onyx'; @@ -64,7 +64,7 @@ function LogInWithShortLivedAuthTokenPage({route, account}: LogInWithShortLivedA if (exitTo) { Navigation.isNavigationReady().then(() => { - const url = NativeModules.HybridAppModule ? Navigation.parseHybridAppUrl(exitTo) : (exitTo as Routes); + const url = NativeModules.HybridAppModule ? Navigation.parseHybridAppUrl(exitTo) : (exitTo as Route); Navigation.navigate(url); }); } diff --git a/src/pages/iou/request/step/IOURequestStepConfirmation.js b/src/pages/iou/request/step/IOURequestStepConfirmation.js index 7a380a49fb33..0a6a4cc610a9 100644 --- a/src/pages/iou/request/step/IOURequestStepConfirmation.js +++ b/src/pages/iou/request/step/IOURequestStepConfirmation.js @@ -96,7 +96,7 @@ function IOURequestStepConfirmation({ const transactionTaxCode = transaction.taxRate && transaction.taxRate.keyForList; const transactionTaxAmount = transaction.taxAmount; const requestType = TransactionUtils.getRequestType(transaction); - const headerTitle = () => { + const headerTitle = useMemo(() => { if (iouType === CONST.IOU.TYPE.SPLIT) { return translate('iou.split'); } @@ -104,7 +104,8 @@ function IOURequestStepConfirmation({ return translate('common.send'); } return translate(TransactionUtils.getHeaderTitleTranslationKey(transaction)); - }; + }, [iouType, transaction, translate]); + const participants = useMemo( () => _.map(transaction.participants, (participant) => { @@ -412,7 +413,7 @@ function IOURequestStepConfirmation({ {({safeAreaPaddingBottomStyle}) => ( { const isSplit = selectedIouType === CONST.IOU.TYPE.SPLIT; - let nextStepIOUType; + let nextStepIOUType = CONST.IOU.TYPE.REQUEST; if (isSplit && iouType !== CONST.IOU.TYPE.REQUEST) { nextStepIOUType = CONST.IOU.TYPE.SPLIT; - } else { - nextStepIOUType = iouType === CONST.IOU.TYPE.SEND ? CONST.IOU.TYPE.SEND : CONST.IOU.TYPE.REQUEST; + } else if (iouType === CONST.IOU.TYPE.SEND) { + nextStepIOUType = CONST.IOU.TYPE.SEND; } IOU.setMoneyRequestTag(transactionID, '');