问题
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
来源:https://stackoverflow.com/questions/66061426/how-do-i-handle-hardware-back-button-of-android-to-screen-which-i-given-to-navig