React Native Firebase onNotificationOpened not able to access data payload

Viewed 69

Using Google Firebase notification in React Native I am not able to access data payload onNotificationOpened.

Below is the example.

this.notificationOpenedListener = firebase.notifications().onNotificationOpened((notificationOpen) => {
  const { title, body } = notificationOpen.notification;
  console.log(JSON.stringify(notificationOpen.data)) // {}
});

notificationOpen.notification.data is undefined.

I am triggering the API in the following format.

{
"to": <dev_token>,
"notification":{
  "title":"Portugal vs. Denmark",
  "body":"great match!" 
},
"data" : {
    "Nick" : "Mario",
    "Room" : "PortugalVSDenmark"
}
}

using react-native-firebase : "5.5.6"

Thanks in advance.

0 Answers
Related