diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index 422dd8fbb03a..bfd7b7d2dfee 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -137,6 +137,7 @@ function resetMoneyRequestInfo(id = '') { receiptFilename: '', transactionID: '', billable: null, + isSplitRequest: false, }); } @@ -2829,9 +2830,10 @@ function setMoneyRequestBillable(billable) { /** * @param {Object[]} participants + * @param {Boolean} isSplitRequest */ -function setMoneyRequestParticipants(participants) { - Onyx.merge(ONYXKEYS.IOU, {participants}); +function setMoneyRequestParticipants(participants, isSplitRequest) { + Onyx.merge(ONYXKEYS.IOU, {participants, isSplitRequest}); } /** diff --git a/src/pages/iou/steps/MoneyRequestConfirmPage.js b/src/pages/iou/steps/MoneyRequestConfirmPage.js index 46367e275af4..616955e1cd80 100644 --- a/src/pages/iou/steps/MoneyRequestConfirmPage.js +++ b/src/pages/iou/steps/MoneyRequestConfirmPage.js @@ -308,6 +308,10 @@ function MoneyRequestConfirmPage(props) { return props.translate('common.send'); } + if (isScanRequest) { + return props.translate('tabSelector.scan'); + } + return props.translate('tabSelector.manual'); }; diff --git a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js index 25e41ba78556..6dac11e70bfe 100644 --- a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js +++ b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js @@ -3,7 +3,6 @@ import {View} from 'react-native'; import PropTypes from 'prop-types'; import {withOnyx} from 'react-native-onyx'; import lodashGet from 'lodash/get'; -import _ from 'underscore'; import CONST from '../../../../CONST'; import ONYXKEYS from '../../../../ONYXKEYS'; import ROUTES from '../../../../ROUTES'; @@ -66,8 +65,13 @@ function MoneyRequestParticipantsPage({iou, selectedTab, route}) { return; } - setHeaderTitle(_.isEmpty(iou.participants) ? translate('tabSelector.manual') : translate('iou.split')); - }, [iou.participants, isDistanceRequest, isSendRequest, translate]); + if (isScanRequest) { + setHeaderTitle(translate('tabSelector.scan')); + return; + } + + setHeaderTitle(iou.isSplitRequest ? translate('iou.split') : translate('tabSelector.manual')); + }, [iou.isSplitRequest, isDistanceRequest, translate, isScanRequest, isSendRequest]); const navigateToConfirmationStep = (moneyRequestType) => { IOU.setMoneyRequestId(moneyRequestType); @@ -118,7 +122,7 @@ function MoneyRequestParticipantsPage({iou, selectedTab, route}) { /> (optionsSelectorRef.current = el)} - participants={iou.participants} + participants={iou.isSplitRequest ? iou.participants : []} onAddParticipants={IOU.setMoneyRequestParticipants} navigateToRequest={() => navigateToConfirmationStep(iouType.current)} navigateToSplit={() => navigateToConfirmationStep(CONST.IOU.MONEY_REQUEST_TYPE.SPLIT)} diff --git a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js index 547d2b7c363a..8cdabdaf6458 100755 --- a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js +++ b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js @@ -156,9 +156,10 @@ function MoneyRequestParticipantsSelector({ * @param {Object} option */ const addSingleParticipant = (option) => { - onAddParticipants([ - {accountID: option.accountID, login: option.login, isPolicyExpenseChat: option.isPolicyExpenseChat, reportID: option.reportID, selected: true, searchText: option.searchText}, - ]); + onAddParticipants( + [{accountID: option.accountID, login: option.login, isPolicyExpenseChat: option.isPolicyExpenseChat, reportID: option.reportID, selected: true, searchText: option.searchText}], + false, + ); navigateToRequest(); }; @@ -197,8 +198,7 @@ function MoneyRequestParticipantsSelector({ }, ]; } - - onAddParticipants(newSelectedOptions); + onAddParticipants(newSelectedOptions, newSelectedOptions.length !== 0); }, [participants, onAddParticipants], );