如何在React Native中检测抽屉通知?

时间:2020-05-13 21:19:04

标签: react-native

我试图将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")
  };
}

谢谢帮助!

0 个答案:

没有答案