I am new to react native. I want that when I press android Hardware back button. I navigate to page or screen which name I have given To that navigation.navigate
I have made this
constructor(props) {
super(props)
this.handleBackButtonClick = this.handleBackButtonClick.bind(this);
}
componentDidMount() {
BackHandler.addEventListener('hardwareBackPress', this.handleBackButtonClick);
}
componentDidUnmount() {
BackHandler.removeEventListener('hardwareBackPress', this.handleBackButtonClick);
}
handleBackButtonClick() {
this.props.navigation.navigate("Browse");
return true;
}
But using this code Its only navigate to previous screen from which I have come. I want to navigate to "browse" screen. please help. thanks
question from:
https://stackoverflow.com/questions/66061426/how-do-i-handle-hardware-back-button-of-android-to-screen-which-i-given-to-navig 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…