question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to access "this" inside the onNotification?

See original GitHub issue

At first I had PushNotification.configure({ in index.android.js outside the class declaration but now I have it inside the componentDidMount, is anything wrong with this?

Now I want to have access to this.state inside the onNotification but I don’t know how.

I tryed to add a PushNotification.addEventListener to an external method but the class doesn’t accept it.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
mklbcommented, May 24, 2016

I know it´s solved but here is a simpler way

      onRegister: (token) => {
        this.handleRegister(token);
      },

      // (required) Called when a remote or local notification is opened or received
      onNotification: (notification) => {
        this.handleNotification(notification);
      },
0reactions
yusfarhanchepacommented, Oct 25, 2018

@mklb thanks so much…very2 appreciate.

Read more comments on GitHub >

github_iconTop Results From Across the Web

OnNotification() function dosen't work when i send ...
1 Answer 1 ... PushNotificationIOS.getInitialNotification().then(notification => { if (!notification) { return; } });. I just implemented and ...
Read more >
How to use the react-native-push-notification.onNotification ...
Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues...
Read more >
Handling Incoming Push Notifications in AWS Amplify - Medium
AWS Amplify provides two push notification configuration functions to configure how push notifications are handled by your app: onNotification, ...
Read more >
ServiceWorkerGlobalScope: notificationclick event - Web APIs
Use the event name in methods like addEventListener() , or set an event ... console.log('On notification click: ', event.notification.tag); ...
Read more >
Receive messages in a JavaScript client - Firebase - Google
If the link value points to a page that is already open in a browser tab, a click on the notification brings that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found