Skip to content

Commit

Permalink
Merge pull request #20815 from adamgrzybowski/@swm/navigation-refacto…
Browse files Browse the repository at this point in the history
…r-correct-stack-pop

fix: dispatch pop always at the root state
  • Loading branch information
grgia authored Jun 16, 2023
2 parents 7b00c47 + 1b11c8c commit ed1cdb3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/components/HeaderWithBackButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ const defaultProps = {
title: '',
subtitle: '',
onDownloadButtonPress: () => {},
onBackButtonPress: Navigation.goBack,
onCloseButtonPress: Navigation.dismissModal,
onBackButtonPress: () => Navigation.goBack(),
onCloseButtonPress: () => Navigation.dismissModal(),
onThreeDotsButtonPress: () => {},
shouldShowBorderBottom: false,
shouldShowDownloadButton: false,
Expand Down
2 changes: 1 addition & 1 deletion src/libs/Navigation/Navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ function dismissModal(targetReportID) {
action.type = 'REPLACE';
navigationRef.current.dispatch(action);
} else {
navigationRef.current.dispatch(StackActions.pop());
navigationRef.current.dispatch({...StackActions.pop(), target: rootState.key});
}
} else {
Log.hmmm('[Navigation] dismissModal failed because there is no modal stack to dismiss');
Expand Down

0 comments on commit ed1cdb3

Please sign in to comment.