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: Browser back button takes to previous modal while modal back button closes it #33829

Merged
merged 1 commit into from
Jan 3, 2024
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/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2029,7 +2029,7 @@ function openReportFromDeepLink(url: string, isAuthenticated: boolean) {
return;
}
if (Session.isAnonymousUser() && !Session.canAccessRouteByAnonymousUser(route)) {
Session.signOutAndRedirectToSignIn();
Session.signOutAndRedirectToSignIn(true);
return;
}

Expand Down
8 changes: 6 additions & 2 deletions src/libs/actions/Session/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ function isAnonymousUser(): boolean {
return sessionAuthTokenType === 'anonymousAccount';
}

function signOutAndRedirectToSignIn() {
function signOutAndRedirectToSignIn(shouldReplaceCurrentScreen?: boolean) {
Log.info('Redirecting to Sign In because signOut() was called');
hideContextMenu(false);
if (!isAnonymousUser()) {
Expand All @@ -110,7 +110,11 @@ function signOutAndRedirectToSignIn() {
if (Navigation.isActiveRoute(ROUTES.SIGN_IN_MODAL)) {
return;
}
Navigation.navigate(ROUTES.SIGN_IN_MODAL);
if (shouldReplaceCurrentScreen) {
Navigation.navigate(ROUTES.SIGN_IN_MODAL, CONST.NAVIGATION.TYPE.UP);
} else {
Navigation.navigate(ROUTES.SIGN_IN_MODAL);
}
Linking.getInitialURL().then((url) => {
const reportID = ReportUtils.getReportIDFromLink(url);
if (reportID) {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/signin/SignInModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function SignInModal() {
shouldEnableMaxHeight
testID={SignInModal.displayName}
>
<HeaderWithBackButton onBackButtonPress={Navigation.dismissModal} />
<HeaderWithBackButton />
<SignInPage isInModal />
</ScreenWrapper>
);
Expand Down
Loading