我试图将react-native的AppState与模糊侦听器一起使用,但是什么也没有出现。我执行了相同的完全相同的代码https://reactnative.dev/docs/appstate,但模糊侦听器无法正常工作。我只想知道通知抽屉(https://developer.android.com/guide/topics/ui/notifiers/notifications#bar-and-drawer)何时出现在我的应用程序屏幕上
export default class AppStateExample extends Component {
state = {
appState: AppState.currentState
};
componentDidMount() {
AppState.addEventListener("blur", this._handleAppStateChange);
}
componentWillUnmount() {
AppState.removeEventListener("blur", this._handleAppStateChange);
}
_handleAppStateChange = nextAppState => {
console.log("test")
};
}
谢谢帮助!