From 8676022a8f71b65e22635156e3e8f2e64c087212 Mon Sep 17 00:00:00 2001 From: danielel Date: Mon, 14 Feb 2022 15:39:39 +0200 Subject: [PATCH] get opened notifications from getInitialNotification --- example/NotificationsExampleApp.tsx | 2 +- website/docs/api/general-events.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) 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) => {