erwan erwan - 14 days ago 5
Android Question

Handling back button in React Native, Navigator on Android

I have a

Navigator
in an Android react native application.

I'm using
navigator.push()
to navigate to a different page. It would seem natural that the back button would pop the navigator and to go back one page, but that's not what's happening (it quits the app).

Do the react-native
Navigator
really has no back button support, do I need to plug it myself with a
BackAndroid
?

Answer

Yes, you have to handle the back button yourself. I think the main reason for this is you may want to do different things with the back button instead of just moving back through the stack. I don't know if there are plans to incorporate back button functionality in the future though.

Comments