O'Reilly logo

React Native Cookbook by Crysfel Villa, Stan Bershadskiy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Handling the Android back button

An important feature that all Android devices have is a dedicated back button. By default, the behavior of this back button is to go to the previous running activity. Since React Native generally only has one main React Activity, this will take you out of your application. Sometimes we may not want to have this default behavior, and use the back button inside our React Native application.

This recipe will create a simple example using React Native's latest navigation implementation NavigationExperimental and attach a back button listener to step back through the navigation stack.

Getting ready

For this recipe, it may be a good idea to familiarize yourself with the NavigationExperimental documentation. We have demonstrated ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required