diff --git a/src/components/MoneyRequestReportView/MoneyRequestReportTransactionsNavigation.tsx b/src/components/MoneyRequestReportView/MoneyRequestReportTransactionsNavigation.tsx index ef585b458e6b..759793acbbff 100644 --- a/src/components/MoneyRequestReportView/MoneyRequestReportTransactionsNavigation.tsx +++ b/src/components/MoneyRequestReportView/MoneyRequestReportTransactionsNavigation.tsx @@ -32,8 +32,6 @@ function MoneyRequestReportTransactionsNavigation({currentReportID}: MoneyReques return {prevReportID: prevID, nextReportID: nextID}; }, [currentReportID, reportIDsList]); - const backTo = Navigation.getActiveRoute(); - /** * We clear the sibling transactionThreadIDs when unmounting this component * only when the mount actually goes to a different SCREEN (and not a different version of the same SCREEN) @@ -57,10 +55,12 @@ function MoneyRequestReportTransactionsNavigation({currentReportID}: MoneyReques isPrevButtonDisabled={!prevReportID} isNextButtonDisabled={!nextReportID} onNext={(e) => { + const backTo = Navigation.getActiveRoute(); e?.preventDefault(); Navigation.navigate(ROUTES.SEARCH_REPORT.getRoute({reportID: nextReportID, backTo}), {forceReplace: true}); }} onPrevious={(e) => { + const backTo = Navigation.getActiveRoute(); e?.preventDefault(); Navigation.navigate(ROUTES.SEARCH_REPORT.getRoute({reportID: prevReportID, backTo}), {forceReplace: true}); }}