0
In my app React-Native PWA the back button of Android is closing the application. I tried to use this Backhandler function inside any screen to make it come back instead of closing the app but it doesn’t work. Someone’s been through it and has a solution?
useFocusEffect(useCallback(() => {
const onBackPress = () => {
goBack();
return true
};
BackHandler.addEventListener('hardwareBackPress', onBackPress);
return () =>
BackHandler.removeEventListener('hardwareBackPress', onBackPress);
}, []));
Does not work in PWA.
Welcome to [en.so]. Here the content is in Portuguese, but you can ask your question in English in [so]. About your question is there any screen in the "stack" navigation? Because if there is not, Android actually exits the application as default behavior
– Rafael Tavares
There is a stack created with createStackNavigator. Routes work normal and come back normal with the header back button in PWA. The problem is only the back button of the same android. It closes the app both in PWA installed as using only in the browser
– Tyago Nunes