You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks you !
It's working but I found another issue :(
I'm using the following code :
const onReceived = (event: any) =>
{
event.preventDefault()
const additionalData = event.getNotification().additionalData
if(/*my logic to display only if I want*/)
{
event.getNotification().display();
}
}
useEffect(() =>
{
OneSignal.Notifications.addEventListener('foregroundWillDisplay', onReceived);
return () => {
console.log("removing event...")
OneSignal.Notifications.removeEventListener('foregroundWillDisplay', onReceived);
};
}, []);
So basically, it's working. BUT, the event seems to never be removed, I get the log "removing event..." so removeEventListener is properly called but it's never getting removed. Is it a known issue ? Or a problem in my code ?
How can we help?
Hello,
in older version we listened to incoming notification with
OneSignal.setNotificationWillShowInForegroundHandler
which is still in use in the official documentation...
But I found that we should use event listener NotificationWillDisplayEvent.
How to use it and read notification data ?
Code of Conduct
The text was updated successfully, but these errors were encountered: