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

Use recommended approach for preventing navigation away from a screen #985

Open
achou11 opened this issue Feb 19, 2025 · 0 comments
Open

Comments

@achou11
Copy link
Member

achou11 commented Feb 19, 2025

Prior to React Navigation v7, the recommended approach for overriding back behavior was to use something like the beforeRemove event. However, with v7 there's a note in this section about how this approach doesn't work with @react-navigation/native-stack, which is applicable to us:

Preventing the action in this event doesn't work properly with @react-navigation/native-stack. We recommend using the usePreventRemove hook instead.

We should update our approach to use the new recommended approach as documented here: https://reactnavigation.org/docs/preventing-going-back/

Until then, we might run into potential issues caused by us unintentionally allowing a user to navigate away from a screen.

@achou11 achou11 changed the title use recommended Use recommended approach for preventing navigation away from a screen Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant