Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expo Notification - useLastNotificationResponse Invalid hook call #335

Open
petertanko opened this issue Sep 10, 2021 · 1 comment
Open

Comments

@petertanko
Copy link

petertanko commented Sep 10, 2021

Hi!

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

That's how i use it:

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!

@thajdu
Copy link

thajdu commented Oct 14, 2021

I have a same problem. IS there an issue with this code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants