firebase.notifications (). onNotificationOpened вызывается несколько раз - PullRequest
1 голос
/ 08 мая 2020

Я вызвал firebase.notifications (). OnNotificationOpened на componentDidMount и удалил его на componentWillUnmount () Но похоже, что он никогда не удаляет его как зарегистрированный несколько раз, когда приложение удаляется из фона. Ниже приведен код, который я использовал. Сообщите мне, что я делаю не так.

        notificationOpenedListener = firebase.notifications().onNotificationOpened((notificationOpen: any) => {
        console.log("onNotificationOpened", notificationOpen);
        notificationOpen &&  notificationOpen.notification && notificationOpen.notification._data && notificationOpen.notification._data.extra && setTimeout(() => {
               }, 500);
    });

 async componentDidMount() {
        this.notificationOpenedListener = 
        firebase.notifications().onNotificationOpened((notificationOpen: any) => {});
  }

componentWillUnmount() {
      this.notificationOpenedListener();
  }
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...