react native hardwareBackbutton cause minimize app from Android >= 10

108 Views Asked by At

I dont know how to describe the problem by codes, but my hardwareBackbutton work normally for android devices with OS < 10. Another cause minimize app.

With pop() function from navigation, it's work. Only problem with hardwareBackbutton.

I am using native stack:

    "@react-navigation/bottom-tabs": "^6.3.1",
    "@react-navigation/material-bottom-tabs": "^6.2.1",
    "@react-navigation/native": "^6.1.6",
    "@react-navigation/native-stack": "^6.9.12",
    "@react-navigation/stack": "^6.3.7",
    "react": "^18.2.0",
    "react-native": "^0.71.8",


...


export const Stack = createNativeStackNavigator()

Here is the video I captured: Video here

1

There are 1 best solutions below

0
famfamfam On

OK I found problem because OnBackInvokedCallback putted on AndroidManifest, as doc here:

This replaces Activity#onBackPressed(), Dialog#onBackPressed() and KeyEvent.KEYCODE_BACK

https://developer.android.com/reference/android/window/OnBackInvokedCallback