diff --git a/src/libs/actions/App.js b/src/libs/actions/App.js index 860d4ce47b91..cd0550c0bdad 100644 --- a/src/libs/actions/App.js +++ b/src/libs/actions/App.js @@ -100,7 +100,7 @@ function setLocale(locale) { */ function setLocaleAndNavigate(locale) { setLocale(locale); - Navigation.navigate(ROUTES.SETTINGS_PREFERENCES); + Navigation.goBack(ROUTES.SETTINGS_PREFERENCES); } function setSidebarLoaded() { diff --git a/src/libs/actions/PaymentMethods.js b/src/libs/actions/PaymentMethods.js index 07e8a9304e24..cf55cc3f74b9 100644 --- a/src/libs/actions/PaymentMethods.js +++ b/src/libs/actions/PaymentMethods.js @@ -272,7 +272,7 @@ function saveWalletTransferMethodType(filterPaymentMethodType) { function dismissSuccessfulTransferBalancePage() { Onyx.merge(ONYXKEYS.WALLET_TRANSFER, {shouldShowSuccess: false}); - Navigation.navigate(ROUTES.SETTINGS_PAYMENTS); + Navigation.goBack(ROUTES.SETTINGS_PAYMENTS); } /** diff --git a/src/libs/actions/PersonalDetails.js b/src/libs/actions/PersonalDetails.js index 50c47eae340a..dd80992e64a4 100644 --- a/src/libs/actions/PersonalDetails.js +++ b/src/libs/actions/PersonalDetails.js @@ -143,7 +143,7 @@ function updatePronouns(pronouns) { ], }, ); - Navigation.navigate(ROUTES.SETTINGS_PROFILE); + Navigation.goBack(ROUTES.SETTINGS_PROFILE); } /** @@ -173,7 +173,7 @@ function updateDisplayName(firstName, lastName) { ], }, ); - Navigation.navigate(ROUTES.SETTINGS_PROFILE); + Navigation.goBack(ROUTES.SETTINGS_PROFILE); } /** @@ -197,7 +197,7 @@ function updateLegalName(legalFirstName, legalLastName) { ], }, ); - Navigation.navigate(ROUTES.SETTINGS_PERSONAL_DETAILS); + Navigation.goBack(ROUTES.SETTINGS_PERSONAL_DETAILS); } /** @@ -219,7 +219,7 @@ function updateDateOfBirth({dob}) { ], }, ); - Navigation.navigate(ROUTES.SETTINGS_PERSONAL_DETAILS); + Navigation.goBack(ROUTES.SETTINGS_PERSONAL_DETAILS); } /** @@ -262,7 +262,7 @@ function updateAddress(street, street2, city, state, zip, country) { }, ], }); - Navigation.navigate(ROUTES.SETTINGS_PERSONAL_DETAILS); + Navigation.goBack(ROUTES.SETTINGS_PERSONAL_DETAILS); } /** diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index 0e36eb80babf..d5374c67cc1c 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -1160,7 +1160,7 @@ function saveReportActionDraftNumberOfLines(reportID, reportActionID, numberOfLi */ function updateNotificationPreferenceAndNavigate(reportID, previousValue, newValue) { if (previousValue === newValue) { - Navigation.navigate(ROUTES.getReportSettingsRoute(reportID)); + Navigation.goBack(ROUTES.getReportSettingsRoute(reportID)); return; } const optimisticData = [ @@ -1178,7 +1178,7 @@ function updateNotificationPreferenceAndNavigate(reportID, previousValue, newVal }, ]; API.write('UpdateReportNotificationPreference', {reportID, notificationPreference: newValue}, {optimisticData, failureData}); - Navigation.navigate(ROUTES.getReportSettingsRoute(reportID)); + Navigation.goBack(ROUTES.getReportSettingsRoute(reportID)); } /** @@ -1218,7 +1218,7 @@ function updateWelcomeMessage(reportID, previousValue, newValue) { */ function updateWriteCapabilityAndNavigate(report, newValue) { if (report.writeCapability === newValue) { - Navigation.navigate(ROUTES.getReportSettingsRoute(report.reportID)); + Navigation.goBack(ROUTES.getReportSettingsRoute(report.reportID)); return; } @@ -1238,7 +1238,7 @@ function updateWriteCapabilityAndNavigate(report, newValue) { ]; API.write('UpdateReportWriteCapability', {reportID: report.reportID, writeCapability: newValue}, {optimisticData, failureData}); // Return to the report settings page since this field utilizes push-to-page - Navigation.navigate(ROUTES.getReportSettingsRoute(report.reportID)); + Navigation.goBack(ROUTES.getReportSettingsRoute(report.reportID)); } /** @@ -1407,7 +1407,7 @@ function updatePolicyRoomNameAndNavigate(policyRoomReport, policyRoomName) { // No change needed, navigate back if (previousName === policyRoomName) { - Navigation.navigate(ROUTES.getReportSettingsRoute(reportID)); + Navigation.goBack(ROUTES.getReportSettingsRoute(reportID)); return; } const optimisticData = [ @@ -1446,7 +1446,7 @@ function updatePolicyRoomNameAndNavigate(policyRoomReport, policyRoomName) { }, ]; API.write('UpdatePolicyRoomName', {reportID, policyRoomName}, {optimisticData, successData, failureData}); - Navigation.navigate(ROUTES.getReportSettingsRoute(reportID)); + Navigation.goBack(ROUTES.getReportSettingsRoute(reportID)); } /** diff --git a/src/libs/actions/User.js b/src/libs/actions/User.js index 24ebc13139bc..bfb530c54872 100644 --- a/src/libs/actions/User.js +++ b/src/libs/actions/User.js @@ -236,7 +236,7 @@ function deleteContactMethod(contactMethod, loginList) { }, {optimisticData, successData, failureData}, ); - Navigation.navigate(ROUTES.SETTINGS_CONTACT_METHODS); + Navigation.goBack(ROUTES.SETTINGS_CONTACT_METHODS); } /** @@ -622,7 +622,7 @@ function updateChatPriorityMode(mode) { }, {optimisticData}, ); - Navigation.navigate(ROUTES.SETTINGS_PREFERENCES); + Navigation.goBack(ROUTES.SETTINGS_PREFERENCES); } /** @@ -777,7 +777,7 @@ function setContactMethodAsDefault(newDefaultContactMethod) { }, ]; API.write('SetContactMethodAsDefault', {partnerUserID: newDefaultContactMethod}, {optimisticData, successData, failureData}); - Navigation.navigate(ROUTES.SETTINGS_CONTACT_METHODS); + Navigation.goBack(ROUTES.SETTINGS_CONTACT_METHODS); } /** diff --git a/src/pages/settings/Payments/ChooseTransferAccountPage.js b/src/pages/settings/Payments/ChooseTransferAccountPage.js index 0443401a62f1..ac3a8ac8546f 100644 --- a/src/pages/settings/Payments/ChooseTransferAccountPage.js +++ b/src/pages/settings/Payments/ChooseTransferAccountPage.js @@ -37,7 +37,7 @@ function ChooseTransferAccountPage(props) { */ const selectAccountAndNavigateBack = (event, accountType, account) => { PaymentMethods.saveWalletTransferAccountTypeAndID(accountType, accountType === CONST.PAYMENT_METHODS.BANK_ACCOUNT ? account.bankAccountID : account.fundID); - Navigation.navigate(ROUTES.SETTINGS_PAYMENTS_TRANSFER_BALANCE); + Navigation.goBack(ROUTES.SETTINGS_PAYMENTS_TRANSFER_BALANCE); }; /** diff --git a/src/pages/settings/Profile/Contacts/ContactMethodDetailsPage.js b/src/pages/settings/Profile/Contacts/ContactMethodDetailsPage.js index 579e2b962cee..c8240e950d40 100644 --- a/src/pages/settings/Profile/Contacts/ContactMethodDetailsPage.js +++ b/src/pages/settings/Profile/Contacts/ContactMethodDetailsPage.js @@ -112,7 +112,7 @@ class ContactMethodDetailsPage extends Component { // Navigate to methods page on successful magic code verification // validateLogin property of errorFields & prev pendingFields is responsible to decide the status of the magic code verification if (!errorFields.validateLogin && prevPendingFields.validateLogin === CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE) { - Navigation.navigate(ROUTES.SETTINGS_CONTACT_METHODS); + Navigation.goBack(ROUTES.SETTINGS_CONTACT_METHODS); } } diff --git a/src/pages/tasks/NewTaskDescriptionPage.js b/src/pages/tasks/NewTaskDescriptionPage.js index a162c2c2c549..520af1491e0a 100644 --- a/src/pages/tasks/NewTaskDescriptionPage.js +++ b/src/pages/tasks/NewTaskDescriptionPage.js @@ -44,7 +44,7 @@ function NewTaskDescriptionPage(props) { // the response const onSubmit = (values) => { Task.setDescriptionValue(values.taskDescription); - Navigation.navigate(ROUTES.NEW_TASK); + Navigation.goBack(ROUTES.NEW_TASK); }; if (!Permissions.canUseTasks(props.betas)) { diff --git a/src/pages/tasks/NewTaskTitlePage.js b/src/pages/tasks/NewTaskTitlePage.js index 7abbdcd5090b..14d7e7d23b9e 100644 --- a/src/pages/tasks/NewTaskTitlePage.js +++ b/src/pages/tasks/NewTaskTitlePage.js @@ -59,7 +59,7 @@ function NewTaskTitlePage(props) { // the response function onSubmit(values) { Task.setTitleValue(values.taskTitle); - Navigation.navigate(ROUTES.NEW_TASK); + Navigation.goBack(ROUTES.NEW_TASK); } if (!Permissions.canUseTasks(props.betas)) { diff --git a/src/pages/workspace/WorkspaceInitialPage.js b/src/pages/workspace/WorkspaceInitialPage.js index b1f797eb239c..10732a661dfc 100644 --- a/src/pages/workspace/WorkspaceInitialPage.js +++ b/src/pages/workspace/WorkspaceInitialPage.js @@ -60,7 +60,7 @@ function openEditor(policyID) { * @param {string} policyID */ function dismissError(policyID) { - Navigation.navigate(ROUTES.SETTINGS_WORKSPACES); + Navigation.goBack(ROUTES.SETTINGS_WORKSPACES); Policy.removeWorkspace(policyID); } @@ -78,8 +78,7 @@ function WorkspaceInitialPage(props) { Policy.deleteWorkspace(policy.id, policyReports, policy.name); setIsDeleteModalOpen(false); // Pop the deleted workspace page before opening workspace settings. - Navigation.goBack(); - Navigation.navigate(ROUTES.SETTINGS_WORKSPACES); + Navigation.goBack(ROUTES.SETTINGS_WORKSPACES); }, [props.reports, policy]); useEffect(() => { diff --git a/src/pages/workspace/WorkspaceSettingsPage.js b/src/pages/workspace/WorkspaceSettingsPage.js index 50875a17b735..92b01891bbdf 100644 --- a/src/pages/workspace/WorkspaceSettingsPage.js +++ b/src/pages/workspace/WorkspaceSettingsPage.js @@ -60,7 +60,7 @@ function WorkspaceSettingsPage(props) { const outputCurrency = values.currency; Policy.updateGeneralSettings(props.policy.id, values.name.trim(), outputCurrency); Keyboard.dismiss(); - Navigation.navigate(ROUTES.getWorkspaceInitialRoute(props.policy.id)); + Navigation.goBack(ROUTES.getWorkspaceInitialRoute(props.policy.id)); }, [props.policy.id, props.policy.isPolicyUpdating], ); diff --git a/src/pages/workspace/reimburse/WorkspaceRateAndUnitPage.js b/src/pages/workspace/reimburse/WorkspaceRateAndUnitPage.js index 34753d7272b5..056cb76ffb22 100644 --- a/src/pages/workspace/reimburse/WorkspaceRateAndUnitPage.js +++ b/src/pages/workspace/reimburse/WorkspaceRateAndUnitPage.js @@ -87,7 +87,7 @@ class WorkspaceRateAndUnitPage extends React.Component { submit(values) { this.saveUnitAndRate(values.unit, values.rate); Keyboard.dismiss(); - Navigation.navigate(ROUTES.getWorkspaceReimburseRoute(this.props.policy.id)); + Navigation.goBack(ROUTES.getWorkspaceReimburseRoute(this.props.policy.id)); } validate(values) {