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; } 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); 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} />