I am working on react-native to develop a sample application. Here I got an issue when I was using backHandler
in the react-native side-menu component.
Actually, the side menu contains more pages! But when clicking the Android back button in the side menu pages, only once the back handler works. Here I am using react-native router-flux.
Here the back button action is called only once!
This is my code:
componentDidMount() {
BackHandler.addEventListener('hardwareBackPress', this.handleBackPress);
}
componentWillUnmount() {
BackHandler.removeEventListener('hardwareBackPress', this.handleBackPress);
}
handleBackPress = () => {
let {isGoback} = this.props.isGoback
//alert("Hi " + isGoback)
if(isGoback === "Contact Us"){
//alert("Hi: " + isGoback)
Actions.BasicSideMenuMain({selectedItem:'Home'});
//Actions.replace('BasicSideMenuMain')
}
}