我想使用react native在特定页面上禁用android后退按钮处理程序
禁用Android设备后退按钮
它将处理Back Press,
import { BackHandler } from 'react-native';
constructor(props) {
super(props)
}
componentWillMount() {
BackHandler.addEventListener('hardwareBackPress', this.handleBackButtonClick);
}
componentWillUnmount() {
BackHandler.removeEventListener('hardwareBackPress', this.handleBackButtonClick);
}
handleBackButtonClick = () => {
this.props.navigation.goBack(null);
return true;
};