1.安卓back鍵的處理主要就是一個事件監(jiān)聽
BackAndroid.addEventListener('hardwareBackPress', this.onBackPressed);
BackAndroid.removeEventListener('hardwareBackPress', this.onBackPressed);
componentWillMount() {
if (Platform.OS == = 'android') {
BackAndroid.addEventListener('hardwareBackPress', this.onBackAndroid);
}
}
componentWillUnmount() {
if (Platform.OS == = 'android') {
BackAndroid.removeEventListener('hardwareBackPress', this.onBackAndroid);
}
}