-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
App not exit when press back button on Android #2487
Comments
same thing happens to me |
+1 |
I found solution, just use BackHandler.exitApp() instead of return false
|
Actual solution is to use |
As a workaround, you can get a hold of the action and test for 'Navigation/BACK' in the reducer. Then you can call BackHandler.exitApp(). Obviously, this solution is sub optimal but it does work if you're stuck as the listener doesn't fire but the events are still coming through the reducer.
Officially, I don't recommend this but I didn't find any other way to make it happen. |
as @vishnuc said, add this in your Router code :
Then, the backButton will be handled by the library and if you want to do a specific action in a component with the backButton, it will override the onBackPress function. Like this :
Doing that in my Android app, never had a problem. |
I'm having an issue with exiting the app when navigation from other screens work on initial load though. |
Hope this will help : https://gist.github.com/Abhishekgarg727/447727a32e284c24346ec6d1a83feefe |
@dreamteryst how can this be made to work when there's an app drawer? My challenge is that subsequent screens continue to see Home screen, as this.props.navigation.state.routeName === 'Home'. |
@dreamteryst Blapi
aaaa. thank you! I half a day could not find a solution! |
Version
Expected behaviour
This is my router.
Go to Drawer or auth :
Handle back button :
Actual behaviour
onBackPress return false but my app nothing happen.
The text was updated successfully, but these errors were encountered: