Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/libs/actions/IOU.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ function resetMoneyRequestInfo(id = '') {
receiptFilename: '',
transactionID: '',
billable: null,
isSplitRequest: false,
});
}

Expand Down Expand Up @@ -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});
}

/**
Expand Down
4 changes: 4 additions & 0 deletions src/pages/iou/steps/MoneyRequestConfirmPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,10 @@ function MoneyRequestConfirmPage(props) {
return props.translate('common.send');
}

if (isScanRequest) {
return props.translate('tabSelector.scan');
}

return props.translate('tabSelector.manual');
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -118,7 +122,7 @@ function MoneyRequestParticipantsPage({iou, selectedTab, route}) {
/>
<MoneyRequestParticipantsSelector
ref={(el) => (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)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
};

Expand Down Expand Up @@ -197,8 +198,7 @@ function MoneyRequestParticipantsSelector({
},
];
}

onAddParticipants(newSelectedOptions);
onAddParticipants(newSelectedOptions, newSelectedOptions.length !== 0);
},
[participants, onAddParticipants],
);
Expand Down