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

PushNotificationIOS.getInitialNotification() returns null for Remote Notification on cold start #23752

Closed
rliubigfoot opened this issue Mar 4, 2019 · 3 comments
Labels
API: PushNotificationIOS Bug Platform: iOS iOS applications. Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.

Comments

@rliubigfoot
Copy link

🐛 Bug Report

Same issue as #9372, I am using the PushNotificationIOS.getInitialNotification function to check if the app is opened from a notification. This works when the app is launched from the background but not when the app has been force closed.

To Reproduce

  1. force quit the app
  2. send a remote notification
  3. click notification banner to open the app

Expected Behavior

Expect a non-null notification in PushNotificationIOS.getInitialNotification and appOpenedByNotificationTap should be triggered. Instead, the notification is null.

Code Example

in composition.js:

function appOpenedByNotificationTap(notification) {
  AlertIOS.alert('appOpenedByNotificationTap');
}

PushNotificationIOS.getInitialNotification().then(function (notification) {
  if (notification != null) {
    appOpenedByNotificationTap(notification);
  } else {
    AlertIOS.alert('notification is null');
  }
});

Environment

Environment:
OS: macOS High Sierra 10.13.6
Node: 9.3.0
Yarn: Not Found
npm: 5.6.0
Watchman: 4.9.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: Not Found

Packages: (wanted => installed)
react: 16.3.1 => 16.3.1
react-native: 0.55.4 => 0.55.4

@react-native-bot
Copy link
Collaborator

It looks like you are using an older version of React Native. Please update to the latest release, v0.58 and verify if the issue still exists.

The "Resolution: Old Version" label will be removed automatically once you edit your original post with the results of running react-native info on a project using the latest release.

@react-native-bot react-native-bot added the Ran Commands One of our bots successfully processed a command. label Mar 19, 2019
@react-native-bot
Copy link
Collaborator

I am closing this issue because it does not appear to have been verified on the latest release, and there has been no followup in a while.

If you found this thread after encountering the same issue in the latest release, please feel free to create a new issue with up-to-date information by clicking here.

@mak12
Copy link

mak12 commented Feb 13, 2020

hi @rliubigfoot any luck with finding its solution ?

@facebook facebook locked as resolved and limited conversation to collaborators Mar 19, 2020
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Mar 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
API: PushNotificationIOS Bug Platform: iOS iOS applications. Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

3 participants