Tutorial by Examples

BackAndroid.addEventListener('hardwareBackPress', function() { if (!this.onMainScreen()) { this.goBack(); return true; } return false; }); Note: this.onMainScreen() and this.goBack() are not built in functions, you also need to implement those. (https://github.c...
This is an example on how to use React Native's BackAndroid along with the Navigator. componentWillMount registers an event listener to handle the taps on the back button. It checks if there is another view in the history stack, and if there is one, it goes back -otherwise it keeps the default beha...
Since BackAndroid is deprecated. Use BackHandler instead of BackAndroid. import { BackHandler } from 'react-native'; {...} ComponentWillMount(){ BackHandler.addEventListener('hardwareBackPress',()=>{ if (!this.onMainScreen()) { this.goBack(); return true; ...
This example will show you back navigation which is expected generally in most of the flows. You will have to add following code to every screen depending on expected behavior. There are 2 cases: If there are more than 1 screen on stack, device back button will show previous screen. If there is ...

Page 1 of 1