I'm working on react native Android and face problem for hardware back button my react native version is 0.44.2 and I'm using BackHandler below is my code for the back button:
BackHandler.addEventListener("hardwareBackPress", () => {
if (this.navigator && this.navigator.getCurrentRoutes().length > 1){this.navigator.pop()
return true // do not exit app
} else {
return false // exit app
}})
I got the following error: