Skip to content

Commit

Permalink
Merge pull request #32851 from s-alves10/fix/issue-32826
Browse files Browse the repository at this point in the history
(cherry picked from commit 6086c84)
  • Loading branch information
luacmartins authored and OSBotify committed Dec 12, 2023
1 parent 5258375 commit a380134
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/pages/iou/request/step/IOURequestStepAmount.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,16 @@ const defaultProps = {
function IOURequestStepAmount({
report,
route: {
params: {iouType, reportID, transactionID, backTo},
params: {iouType, reportID, transactionID, backTo, currency: selectedCurrency},
},
transaction,
transaction: {currency},
transaction: {currency: originalCurrency},
}) {
const {translate} = useLocalize();
const textInput = useRef(null);
const focusTimeoutRef = useRef(null);
const iouRequestType = getRequestType(transaction);
const currency = selectedCurrency || originalCurrency;

useFocusEffect(
useCallback(() => {
Expand Down
14 changes: 10 additions & 4 deletions src/pages/iou/request/step/IOURequestStepCurrency.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,18 @@ function IOURequestStepCurrency({
const [searchValue, setSearchValue] = useState('');
const optionsSelectorRef = useRef();

const navigateBack = () => {
const navigateBack = (selectedCurrency = undefined) => {
// If the currency selection was done from the confirmation step (eg. + > request money > manual > confirm > amount > currency)
// then the user needs taken back to the confirmation page instead of the initial amount page. This is because the route params
// are only able to handle one backTo param at a time and the user needs to go back to the amount page before going back
// to the confirmation page
if (pageIndex === 'confirm') {
const routeToAmountPageWithConfirmationAsBackTo = getUrlWithBackToParam(backTo, `/${ROUTES.MONEY_REQUEST_STEP_CONFIRMATION.getRoute(iouType, transactionID, reportID)}`);
Navigation.goBack(routeToAmountPageWithConfirmationAsBackTo);
if (selectedCurrency) {
Navigation.navigate(`${routeToAmountPageWithConfirmationAsBackTo}&currency=${selectedCurrency}`);
} else {
Navigation.goBack(routeToAmountPageWithConfirmationAsBackTo);
}
return;
}
Navigation.goBack(backTo || ROUTES.HOME);
Expand All @@ -78,8 +82,10 @@ function IOURequestStepCurrency({
*/
const confirmCurrencySelection = (option) => {
Keyboard.dismiss();
IOU.setMoneyRequestCurrency_temporaryForRefactor(transactionID, option.currencyCode);
navigateBack();
if (pageIndex !== 'confirm') {
IOU.setMoneyRequestCurrency_temporaryForRefactor(transactionID, option.currencyCode);
}
navigateBack(option.currencyCode);
};

const {sections, headerMessage, initiallyFocusedOptionKey} = useMemo(() => {
Expand Down

0 comments on commit a380134

Please sign in to comment.