Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update request money header title #29936

Merged
merged 10 commits into from
Oct 27, 2023
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
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
Loading