I am using react native 0.73.0
, react-navigation/native and native-stack 6.1.10 and 6.9.18,
when the android back button is pressed or swipe gesture to go back, rather than going to the previous screen in the stack the app closes
This issue does not happen on android devices with android 11 or below.
Initially I did not provide any default options for stack navigation and just to try out things, I have tried giving gesture gestureEnabled
as true
and also false
as default screen options.
I will try to fix the issue and will be commenting the solution if it gets fixed, but if anyone has faced the issue or has a potential solution to the problem, please help....
This fixed the issue for me - hopefully it does for you too. https://developer.android.com/guide/navigation/custom-back/predictive-back-gesture#migrate-existing
implementation "androidx.activity:activity:1.6.0-alpha05"
to project build.gradleandroid:enableOnBackInvokedCallback="false"
to either the application or specific activity in AndroidManifest.xml