From 2d51b22de8e002627326be97158087cb49227fb0 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Tue, 23 Apr 2024 10:17:55 +0800 Subject: [PATCH 1/3] dismiss modal before navigating to invite page --- src/libs/actions/IOU.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 5f0f3152ed20..1c381ae64c08 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -3072,6 +3072,7 @@ function trackExpense( } } if (action === CONST.IOU.ACTION.SHARE) { + Navigation.dismissModal(); Navigation.navigate(ROUTES.ROOM_INVITE.getRoute(activeReportID ?? '', CONST.IOU.SHARE.ROLE.ACCOUNTANT)); } else { Navigation.dismissModal(activeReportID); From 97b4a11212c3827a59df09858c530cb4176925d8 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Tue, 23 Apr 2024 10:18:03 +0800 Subject: [PATCH 2/3] fix infinite back loop --- src/pages/RoomInvitePage.tsx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/pages/RoomInvitePage.tsx b/src/pages/RoomInvitePage.tsx index 79198e81fc43..703a87c9510a 100644 --- a/src/pages/RoomInvitePage.tsx +++ b/src/pages/RoomInvitePage.tsx @@ -184,6 +184,14 @@ function RoomInvitePage({ Navigation.navigate(backRoute); }, [selectedOptions, backRoute, reportID, validate]); + const goBack = useCallback(() => { + if (role === CONST.IOU.SHARE.ROLE.ACCOUNTANT) { + Navigation.dismissModal(reportID); + return; + } + Navigation.goBack(backRoute); + }, [role, reportID, backRoute]); + const headerMessage = useMemo(() => { const searchValue = searchTerm.trim().toLowerCase(); const expensifyEmails = CONST.EXPENSIFY_EMAILS as string[]; @@ -212,14 +220,12 @@ function RoomInvitePage({ Navigation.goBack(backRoute)} + onBackButtonPress={goBack} > { - Navigation.goBack(backRoute); - }} + onBackButtonPress={goBack} /> Date: Tue, 23 Apr 2024 18:50:05 +0800 Subject: [PATCH 3/3] just go back when it's a share action --- src/libs/IOUUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/IOUUtils.ts b/src/libs/IOUUtils.ts index 4a4ce6407fa2..48ebee0e68a1 100644 --- a/src/libs/IOUUtils.ts +++ b/src/libs/IOUUtils.ts @@ -9,7 +9,7 @@ import Navigation from './Navigation/Navigation'; import * as TransactionUtils from './TransactionUtils'; function navigateToStartMoneyRequestStep(requestType: IOURequestType, iouType: IOUType, transactionID: string, reportID: string, iouAction?: IOUAction): void { - if (iouAction === CONST.IOU.ACTION.CATEGORIZE || iouAction === CONST.IOU.ACTION.SUBMIT) { + if (iouAction === CONST.IOU.ACTION.CATEGORIZE || iouAction === CONST.IOU.ACTION.SUBMIT || iouAction === CONST.IOU.ACTION.SHARE) { Navigation.goBack(); return; }