在生命周期componentDidMount中(必须要写在生命周期中): componentDidMount() { if (Platform.OS === 'android') { BackHandler.addEventListener('hardwareBackPress', () => { if ('可以返回的条件') { console.log('可以返回') return false; } console.log('不能返回') return true; }); } }
react native 中android物理返回键BackHandler
猜你喜欢
转载自blog.csdn.net/qq_40054213/article/details/87914502
今日推荐
周排行