Expo Notification - useLastNotificationResponse Invalid hook call

Author: petertankoCreated Sep 10, 2021Updated Oct 14, 2021

Hi!

I would like to catch the notification events, but useLastNotificationResponse listener returns "Invalid hook call".

That's how i use it:

javascript
created() {
    const lastNotificationResponse = Notifications.useLastNotificationResponse();
    if (lastNotificationResponse && lastNotificationResponse.notification) {
      this._handleNotification(lastNotificationResponse.notification);
    }
    Notifications.addNotificationReceivedListener(this._handleNotification);
    Notifications.addNotificationResponseReceivedListener((response) => {
      this._handleNotification(response.notification);
    });
  }

SDK version: 40

Thanks in advance!

Source: GeekyAnts/vue-native-core