I do not want to show "NEW_MSG" Push Notification type in a specific screen. I coded below code but when I test it I always get a notification. How can I fix it?
useEffect(() => {
notificationListener.current = Notifications.addNotificationReceivedListener(
(notification) => {
const {
room_id,
message_text,
type,
} = notification.request.content.data;
// I do not want to show NEW_MSG,
if (type == "NEW_MSG") {
console.log(notification);
return;
}
}
);
return () => {
// Unsubscribe when component unmmounts
Notifications.removeNotificationSubscription(
notificationListener.current
);
};
}, []);
Note: I use Expo Notifications
from Do not show specific notification React Native
No comments:
Post a Comment