Я использую Resact-Native-Firebase для уведомлений в своем собственном проекте React, и я пытаюсь вызвать onNotificationOpened и getInitialNotification из componentDidMount, но эти два метода не вызывают, любое предложение будет оценено
this.removeNotificationOpenedListener = firebase.notifications().onNotificationOpened((notificationOpen: NotificationOpen) => {
console.log('onNotificationOpened AppJS :', notificationOpen)
const { action, notification } = notificationOpen
let item = JSON.parse(notification.data.body)
console.log('onNotificationOpened AppJS : body ', item)
console.log('onNotificationOpened AppJS : action ', action)
})
firebase.notifications().getInitialNotification()
.then((notificationOpen: NotificationOpen) => {
if (notificationOpen) {
console.log('getInitialNotification AppJS : Shoeb ########: ')
// App was opened by a notification
// Get the action triggered by the notification being opened
const { action, notification } = notificationOpen
let item = JSON.parse(notification.data.body)
console.log('getInitialNotification AppJS : item ', item)
console.log('getInitialNotification AppJS : action ', action)
}
})