From 46764751277a61d9f145785fe06479c2b83d0848 Mon Sep 17 00:00:00 2001 From: Ana Margarida Silva Date: Tue, 19 Sep 2023 16:54:36 +0100 Subject: [PATCH] feat: support missing report when requesting money from FAB This was once implemented by @rezkiy37 but it was mistakenly in another PR --- .../MoneyRequestParticipantsPage.js | 18 +++++++++++++++--- .../MoneyRequestParticipantsSelector.js | 2 +- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js index 1d9f12a9cdbb..f0ec28336f5a 100644 --- a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js +++ b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js @@ -62,7 +62,19 @@ function MoneyRequestParticipantsPage({iou, selectedTab, route}) { setHeaderTitle(_.isEmpty(iou.participants) ? translate('tabSelector.manual') : translate('iou.split')); }, [iou.participants, isDistanceRequest, translate]); - const navigateToNextStep = (moneyRequestType) => { + const navigateToRequestStep = (moneyRequestType, option) => { + if (option.reportID) { + isNewReportIDSelectedLocally.current = true; + IOU.setMoneyRequestId(`${moneyRequestType}${option.reportID}`); + Navigation.navigate(ROUTES.getMoneyRequestConfirmationRoute(moneyRequestType, option.reportID)); + return; + } + + IOU.setMoneyRequestId(moneyRequestType); + Navigation.navigate(ROUTES.getMoneyRequestConfirmationRoute(moneyRequestType, reportID.current)); + }; + + const navigateToSplitStep = (moneyRequestType) => { IOU.setMoneyRequestId(moneyRequestType); Navigation.navigate(ROUTES.getMoneyRequestConfirmationRoute(moneyRequestType, reportID.current)); }; @@ -112,8 +124,8 @@ function MoneyRequestParticipantsPage({iou, selectedTab, route}) { ref={(el) => (optionsSelectorRef.current = el)} participants={iou.participants} onAddParticipants={IOU.setMoneyRequestParticipants} - navigateToRequest={() => navigateToNextStep(CONST.IOU.MONEY_REQUEST_TYPE.REQUEST)} - navigateToSplit={() => navigateToNextStep(CONST.IOU.MONEY_REQUEST_TYPE.SPLIT)} + navigateToRequest={(option) => navigateToRequestStep(CONST.IOU.MONEY_REQUEST_TYPE.REQUEST, option)} + navigateToSplit={() => navigateToSplitStep(CONST.IOU.MONEY_REQUEST_TYPE.SPLIT)} safeAreaPaddingBottomStyle={safeAreaPaddingBottomStyle} iouType={iouType.current} isDistanceRequest={isDistanceRequest} diff --git a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js index 9ff787ebe21b..cf69e6477d3a 100755 --- a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js +++ b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js @@ -150,7 +150,7 @@ function MoneyRequestParticipantsSelector({ */ const addSingleParticipant = (option) => { onAddParticipants([{accountID: option.accountID, login: option.login, isPolicyExpenseChat: option.isPolicyExpenseChat, reportID: option.reportID, selected: true}]); - navigateToRequest(); + navigateToRequest(option); }; /**