Open dieptang opened 2 months ago
I am also experiencing the same issue!
Notifee Version: 9.1.1 React Native Version: 0.73.7
Hello 👋, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.
Experiencing the same issue in iOS as well.
Notifee Version: ^9.1.2
React Native Version: ~0.75.4
@react-native-firebase/messaging: ^21.4.0
I have the same issue, and after spending 2 hours figuring it out, you need to set the data
when you display a notification so that when you press the notification, you can get back the data you've passed.
messaging().onMessage(remoteMessage => {
onMessageReceived(remoteMessage);
});
const onMessageReceived = async remoteMessage => {
const {notification, data} = remoteMessage;
await notifee.displayNotification({
title: notification.title,
body: notification.body,
android: {
channelId: CHANNEL_ID,
importance: AndroidImportance.HIGH,
smallIcon: 'noti_icon',
pressAction: {
id: 'default',
launchActivity: 'default',
},
lightUpScreen: true,
},
data, // need to set the data here
});
};
I have the same issue, and after spending 2 hours figuring it out, you need to set the
data
when you display a notification so that when you press the notification, you can get back the data you've passed.messaging().onMessage(remoteMessage => { onMessageReceived(remoteMessage); }); const onMessageReceived = async remoteMessage => { const {notification, data} = remoteMessage; await notifee.displayNotification({ title: notification.title, body: notification.body, android: { channelId: CHANNEL_ID, importance: AndroidImportance.HIGH, smallIcon: 'noti_icon', pressAction: { id: 'default', launchActivity: 'default', }, lightUpScreen: true, }, data, // need to set the data here }); };
I have the same issue of data
not being shown on any handlers when pressed. I'll try this solution and get back
UPDATE: This should be in the documentation. Added the data
props and it worked on Foreground and Kill State. However, still having issue when app is running on background.
Notifee Version: 9.1.2
React Native Version: 0.76.2
I am encountering an issue with the notification.data object being empty when receiving notifications in my React Native application. Here are the details:
Issue Description: When I send a notification with both notification and data payloads from my PHP server, the data field in the notification is empty when handling the notification click event in Notifee.
Example FCM Payload Sent from Server:
Expected Behavior: I expect the notification.data object to contain the keys bookingId and otherInfo when clicking on the notification.
Current Behavior: The notification.data object is empty when the notification is clicked.
I would appreciate your assistance in resolving this issue.
Thank you!