diff --git a/example/NotificationsExampleApp.tsx b/example/NotificationsExampleApp.tsx index 9f88de38d..e50daecf8 100644 --- a/example/NotificationsExampleApp.tsx +++ b/example/NotificationsExampleApp.tsx @@ -124,7 +124,7 @@ export default function NotificationsExampleApp() { const getInitialNotifaction = async () => { const initialNotification = await Notifications.getInitialNotification(); if (initialNotification) { - setNotifications([initialNotification, ...notifications]); + setOpenedNotifications([initialNotification, ...openedNotifications]); } } diff --git a/website/docs/api/general-events.md b/website/docs/api/general-events.md index 314fe2af4..b2ae16753 100755 --- a/website/docs/api/general-events.md +++ b/website/docs/api/general-events.md @@ -44,6 +44,7 @@ To receive background notifications on iOS follow [this guide](https://developer ## registerNotificationOpened() Fired when a remote notification is opened from dead or background state. The handler will be invoked with an instance of [Notification](notification-obj). Should call completion function on iOS, will be ignored on Android. +Being called before component is mounted, if you want to know the initial notification in the component please use [getInitialNotification](general-api#getInitialNotification) on mount. ```js Notifications.events().registerNotificationOpened((notification: Notification, completion: () => void) => {