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

Override Android back button and iOS Swipe back gesture #1845

Closed
fabienbranchel opened this issue Jan 23, 2024 · 2 comments
Closed

Override Android back button and iOS Swipe back gesture #1845

fabienbranchel opened this issue Jan 23, 2024 · 2 comments

Comments

@fabienbranchel
Copy link

Is there any way to override Android back button and iOS Swipe back gesture ?

Searching in previous issues, I find this one pretty close :
#976

You suggest to use AutoRouteGuards for conditional redirecting.
I try it but I can't make it work. It's seems that onNavigation function of guard is only call when navigate, not when we use back button (which is the logical behavior in my opinion).

Am I missing something ?

@gleberemeev
Copy link

You can use WillPopScope or PopScope to override these inputs

@samleecampspot
Copy link

I used PopScope(canPop: false...) to prevent back gestures.

For some reason, my nested route in a tab needed to be refactored from an AutoRoute -> MaterialRoute on iOS because I was still able to navigate backwards w/ the gesture. Android was fine with just the PopScope.canPop == false.

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

3 participants