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.

"popInitialNotification" always return "undefined"

See original GitHub issue

Bug

popInitialNotification method always return ‘undefined’ for local notification. I have tried in both scenarios while the app in background and while the app is closed . Tried both localNotificationSchedule, localNotification methods.

Environment info

react-native info output:

System:
    OS: macOS 11.2
    CPU: (8) x64 Apple M1
    Memory: 86.55 MB / 8.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.16.1 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.14.12 - /usr/local/bin/npm
    Watchman: 4.9.0 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.10.1 - /usr/local/bin/pod
  SDKs:
    iOS SDK: Not Found
    Android SDK: Not Found
  IDEs:
    Android Studio: Not Found
    Xcode: /undefined - /usr/bin/xcodebuild
  Languages:
    Java: Not Found
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.11.0 => 16.11.0 
    react-native: 0.62 => 0.62.3 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Library version: x.x.x

Steps To Reproduce

  1. Initiate a local notification
  2. Local notification received while app is close
  3. Tap on the local notification received
  4. PushNotification.popInitialNotification event triggered but returned with ‘undefined’. …

Describe what you expected to happen:

1.PushNotification.popInitialNotification event should return with local notification details which user clicked. 2.

Reproducible sample code

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:6

github_iconTop GitHub Comments

1reaction
garrettmaringcommented, Sep 3, 2021

@Dallas62 I’ve searched through lot of history and still struggling to handle, on iOS, notifications from a killed state.

I’ve seen a couple random things saying to disabled remote debugging and to build the product in release mode, strange that those would interfere with notifications but I did that.

Given my understanding of popInitialNotification, I thought things would just work out of the box. That is, onNotification would be called from a killed state. That isn’t happening.

So, I see popInitialNotification to false and added my own handler inside the top-most component with a useEffect(() => { PN.popInitialNotification(handler) }, []. That also doesn’t work.

I’ve tried some other things and started messing around with PNIOS.getInitialNotification with no luck. I don’t want to use an iOS only handler anyway though.

From the history of this problem, where would you advise that I look to get notification handling from killed state working on iOS/Android?

0reactions
Dallas62commented, Jun 17, 2021

It’s working only from killed state, but yes for all kind of notifications

Read more comments on GitHub >

github_iconTop Results From Across the Web

Push Notification In React Native - Stack Overflow
Now it is working fine in android but in ios this is always false. ... popInitialNotification: true, requestPermissions: true, }) return ...
Read more >
PushNotificationIOS · React Native
Apps unregistered through this method can always re-register. ... static popInitialNotification() ... Subsequent invocations will return null.
Read more >
Step by Step guide for Implementing Push Notifications in iOS ...
If you are looking out for implementing a push notification on IOS using Google firebase messaging, you landed in the right place. Prerequisite:....
Read more >
data that is returned from useQuery is undefined? : r/reactnative
My backend server got a request from client and returned data. But data in client is empty. What am I missing here? Please...
Read more >
Receiving push notification from Firebase in React Native
popInitialNotification : true, requestPermissions: true }) }, []) return null } ... Always motivate to find new things in react native.
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