Example of Hardware back button detection using BackHandler
suggest changeSince BackAndroid is deprecated. Use BackHandler instead of BackAndroid.
import { BackHandler } from 'react-native';
{...}
ComponentWillMount(){
BackHandler.addEventListener('hardwareBackPress',()=>{
if (!this.onMainScreen()) {
this.goBack();
return true;
}
return false;
});
}
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents