Skip to content

Commit

Permalink
Merge pull request #40740 from bernhardoj/fix/40490-confirmation-page…
Browse files Browse the repository at this point in the history
…-isnt-closed-after-share-expense

Fix confirmation page isn't closed after completing share expense
  • Loading branch information
thienlnam authored Apr 23, 2024
2 parents f408977 + e1e22f0 commit dadf0ba
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/libs/IOUUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions src/libs/actions/IOU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
14 changes: 10 additions & 4 deletions src/pages/RoomInvitePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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[];
Expand Down Expand Up @@ -212,14 +220,12 @@ function RoomInvitePage({
<FullPageNotFoundView
shouldShow={isEmptyObject(report)}
subtitleKey={isEmptyObject(report) ? undefined : 'roomMembersPage.notAuthorized'}
onBackButtonPress={() => Navigation.goBack(backRoute)}
onBackButtonPress={goBack}
>
<HeaderWithBackButton
title={translate('workspace.invite.invitePeople')}
subtitle={reportName}
onBackButtonPress={() => {
Navigation.goBack(backRoute);
}}
onBackButtonPress={goBack}
/>
<SelectionList
canSelectMultiple
Expand Down

0 comments on commit dadf0ba

Please sign in to comment.