Я вызвал 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();
}