How can we help?
I have an issue when I notification is being clicked.
The issue is that every time i close app , the click keeps re-firing even when I already add a removeEventListener.
useEffect(() => {
if (ENV_ONE_SIGNAL_ID) {
// OneSignal Initialization
OneSignal.initialize(ENV_ONE_SIGNAL_ID);
OneSignal.Notifications.requestPermission(true);
OneSignal.Notifications.addEventListener(
"foregroundWillDisplay",
handleForegroundWillDisplay
);
//Method for handling notifications opened
OneSignal.Notifications.addEventListener(
"click",
handleNotificationClick
);
return () => {
OneSignal.Notifications.removeEventListener(
"foregroundWillDisplay",
handleForegroundWillDisplay
);
OneSignal.Notifications.removeEventListener(
"click",
handleNotificationClick
);
};
}
}, []);
Code of Conduct