Skip to content

Commit

Permalink
Merge pull request #20360 from adamgrzybowski/@swm/navigation-refacto…
Browse files Browse the repository at this point in the history
…r-replace-navigate-with-go-back-in-button

fix: always use goBack instead of navigate for header back button
  • Loading branch information
mountiny authored Jun 7, 2023
2 parents 3bccc71 + d4cf445 commit fbd9672
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 12 deletions.
5 changes: 1 addition & 4 deletions src/pages/ReportDetailsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,7 @@ const ReportDetailsPage = (props) => {
return (
<ScreenWrapper>
<FullPageNotFoundView shouldShow={_.isEmpty(props.report)}>
<HeaderWithBackButton
title={props.translate('common.details')}
onBackButtonPress={() => Navigation.goBack()}
/>
<HeaderWithBackButton title={props.translate('common.details')} />
<ScrollView style={[styles.flex1]}>
<View style={styles.reportDetailsTitleContainer}>
<View style={styles.mb3}>
Expand Down
3 changes: 2 additions & 1 deletion src/pages/ShareCodePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import getPlatform from '../libs/getPlatform';
import CONST from '../CONST';
import ContextMenuItem from '../components/ContextMenuItem';
import * as UserUtils from '../libs/UserUtils';
import ROUTES from '../ROUTES';

const propTypes = {
/** The report currently being looked at */
Expand Down Expand Up @@ -49,7 +50,7 @@ class ShareCodePage extends React.Component {
<ScreenWrapper>
<HeaderWithBackButton
title={this.props.translate('common.shareCode')}
onBackButtonPress={() => Navigation.goBack()}
onBackButtonPress={() => Navigation.goBack(isReport ? ROUTES.getReportDetailsRoute(this.props.report.reportID) : ROUTES.SETTINGS)}
/>

<ScrollView style={[styles.flex1, styles.mt3]}>
Expand Down
4 changes: 2 additions & 2 deletions src/pages/settings/Payments/TransferBalancePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,12 @@ class TransferBalancePage extends React.Component {
subtitleKey="transferAmountPage.notHereSubTitle"
shouldShowLink
linkKey="transferAmountPage.goToPayment"
onLinkPress={() => Navigation.navigate(ROUTES.SETTINGS_PAYMENTS)}
onLinkPress={() => Navigation.goBack(ROUTES.SETTINGS_PAYMENTS)}
>
<HeaderWithBackButton
title={this.props.translate('common.transferBalance')}
shouldShowBackButton
onBackButtonPress={() => Navigation.navigate(ROUTES.SETTINGS_PAYMENTS)}
onBackButtonPress={() => Navigation.goBack(ROUTES.SETTINGS_PAYMENTS)}
/>
<View style={[styles.flexGrow1, styles.flexShrink1, styles.flexBasisAuto, styles.justifyContentCenter]}>
<CurrentWalletBalance balanceStyles={[styles.transferBalanceBalance]} />
Expand Down
2 changes: 1 addition & 1 deletion src/pages/workspace/WorkspaceInitialPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ const WorkspaceInitialPage = (props) => {
{({safeAreaPaddingBottomStyle}) => (
<FullPageNotFoundView
shouldShow={_.isEmpty(policy)}
onBackButtonPress={() => Navigation.navigate(ROUTES.SETTINGS_WORKSPACES)}
onBackButtonPress={() => Navigation.goBack(ROUTES.SETTINGS_WORKSPACES)}
>
<HeaderWithBackButton
title={props.translate('workspace.common.workspace')}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/workspace/WorkspaceInviteMessagePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class WorkspaceInviteMessagePage extends React.Component {
<ScreenWrapper includeSafeAreaPaddingBottom={false}>
<FullPageNotFoundView
shouldShow={_.isEmpty(this.props.policy)}
onBackButtonPress={() => Navigation.navigate(ROUTES.SETTINGS_WORKSPACES)}
onBackButtonPress={() => Navigation.goBack(ROUTES.SETTINGS_WORKSPACES)}
>
<HeaderWithBackButton
title={this.props.translate('workspace.inviteMessage.inviteMessageTitle')}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/workspace/WorkspaceInvitePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ class WorkspaceInvitePage extends React.Component {
<ScreenWrapper shouldEnableMaxHeight>
<FullPageNotFoundView
shouldShow={_.isEmpty(this.props.policy)}
onBackButtonPress={() => Navigation.navigate(ROUTES.SETTINGS_WORKSPACES)}
onBackButtonPress={() => Navigation.goBack(ROUTES.SETTINGS_WORKSPACES)}
>
<FormSubmit
style={[styles.flex1]}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/workspace/WorkspaceMembersPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ class WorkspaceMembersPage extends React.Component {
{({safeAreaPaddingBottomStyle}) => (
<FullPageNotFoundView
shouldShow={_.isEmpty(this.props.policy)}
onBackButtonPress={() => Navigation.navigate(ROUTES.SETTINGS_WORKSPACES)}
onBackButtonPress={() => Navigation.goBack(ROUTES.SETTINGS_WORKSPACES)}
>
<HeaderWithBackButton
title={this.props.translate('workspace.common.members')}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/workspace/WorkspacePageWithSections.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class WorkspacePageWithSections extends React.Component {
>
<FullPageNotFoundView
shouldShow={_.isEmpty(this.props.policy)}
onBackButtonPress={() => Navigation.navigate(ROUTES.SETTINGS_WORKSPACES)}
onBackButtonPress={() => Navigation.goBack(ROUTES.SETTINGS_WORKSPACES)}
>
<HeaderWithBackButton
title={this.props.headerText}
Expand Down

0 comments on commit fbd9672

Please sign in to comment.