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

Fix some RHP pages doing a NAVIGATE action instead of go back #22789

Merged
merged 6 commits into from
Jul 27, 2023
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
2 changes: 1 addition & 1 deletion src/libs/actions/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ function setLocale(locale) {
*/
function setLocaleAndNavigate(locale) {
setLocale(locale);
Navigation.navigate(ROUTES.SETTINGS_PREFERENCES);
Navigation.goBack(ROUTES.SETTINGS_PREFERENCES);
}

function setSidebarLoaded() {
Expand Down
2 changes: 1 addition & 1 deletion src/libs/actions/PaymentMethods.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this function is called in TransferBalancePage

<HeaderWithBackButton
title={props.translate('common.transferBalance')}
onBackButtonPress={PaymentMethods.dismissSuccessfulTransferBalancePage}
/>
<ConfirmationPage
heading={props.translate('transferAmountPage.transferSuccess')}
description={
props.walletTransfer.paymentMethodType === CONST.PAYMENT_METHODS.BANK_ACCOUNT
? props.translate('transferAmountPage.transferDetailBankAccount')
: props.translate('transferAmountPage.transferDetailDebitCard')
}
shouldShowButton
buttonText={props.translate('common.done')}
onButtonPress={PaymentMethods.dismissSuccessfulTransferBalancePage}
/>

I can't access to the page, but looking at the code, we want to navigate back, so I change this too


/**
Expand Down
10 changes: 5 additions & 5 deletions src/libs/actions/PersonalDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ function updatePronouns(pronouns) {
],
},
);
Navigation.navigate(ROUTES.SETTINGS_PROFILE);
Navigation.goBack(ROUTES.SETTINGS_PROFILE);
}

/**
Expand Down Expand Up @@ -173,7 +173,7 @@ function updateDisplayName(firstName, lastName) {
],
},
);
Navigation.navigate(ROUTES.SETTINGS_PROFILE);
Navigation.goBack(ROUTES.SETTINGS_PROFILE);
}

/**
Expand All @@ -197,7 +197,7 @@ function updateLegalName(legalFirstName, legalLastName) {
],
},
);
Navigation.navigate(ROUTES.SETTINGS_PERSONAL_DETAILS);
Navigation.goBack(ROUTES.SETTINGS_PERSONAL_DETAILS);
}

/**
Expand All @@ -219,7 +219,7 @@ function updateDateOfBirth({dob}) {
],
},
);
Navigation.navigate(ROUTES.SETTINGS_PERSONAL_DETAILS);
Navigation.goBack(ROUTES.SETTINGS_PERSONAL_DETAILS);
}

/**
Expand Down Expand Up @@ -262,7 +262,7 @@ function updateAddress(street, street2, city, state, zip, country) {
},
],
});
Navigation.navigate(ROUTES.SETTINGS_PERSONAL_DETAILS);
Navigation.goBack(ROUTES.SETTINGS_PERSONAL_DETAILS);
}

/**
Expand Down
12 changes: 6 additions & 6 deletions src/libs/actions/Report.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand All @@ -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));
}

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

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

/**
Expand Down Expand Up @@ -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 = [
Expand Down Expand Up @@ -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));
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/libs/actions/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ function deleteContactMethod(contactMethod, loginList) {
},
{optimisticData, successData, failureData},
);
Navigation.navigate(ROUTES.SETTINGS_CONTACT_METHODS);
Navigation.goBack(ROUTES.SETTINGS_CONTACT_METHODS);
}

/**
Expand Down Expand Up @@ -622,7 +622,7 @@ function updateChatPriorityMode(mode) {
},
{optimisticData},
);
Navigation.navigate(ROUTES.SETTINGS_PREFERENCES);
Navigation.goBack(ROUTES.SETTINGS_PREFERENCES);
}

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

/**
Expand Down
2 changes: 1 addition & 1 deletion src/pages/settings/Payments/ChooseTransferAccountPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above


/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/pages/tasks/NewTaskDescriptionPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/tasks/NewTaskTitlePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
5 changes: 2 additions & 3 deletions src/pages/workspace/WorkspaceInitialPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/workspace/WorkspaceSettingsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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],
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Loading