我想阻止用户返回上一个屏幕.所以我添加了代码,但这不起作用.这有什么解决方案吗?可以看到警报弹出,但"返回false"不起作用.
componentDidMount() {
BackAndroid.addEventListener('hardwareBackPress', () => {
Alert.alert("alert","alert")
this.props.navigator.pop();
return false;
});
Run Code Online (Sandbox Code Playgroud)