DEV Community

Kay Gosho
Kay Gosho

Posted on

4 2

Getting initial notification in React Native

Getting initial notification in React Native seems not to work RN 0.59.x.

https://github.com/react-native-community/react-native-push-notification-ios/issues/24

I'll try to find a solution. current possible solutions in my mind are:

1. Save userData in didReceiveRemoteNotification

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
{
  [RNCPushNotificationIOS didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];

  // save userData to somewhere
}

2. Build a native module

Accessing userData via Native modules. It seems that we can access to userData after app launch.

https://github.com/react-native-community/react-native-push-notification-ios/blob/master/js/index.js#L346

https://github.com/react-native-community/react-native-push-notification-ios/blob/3cf608c83dac011634429fbebd7d55a7c6ae8c13/ios/RNCPushNotificationIOS.m#L407

UIApplicationLaunchOptionsRemoteNotificationKey not getting userinfo - https://stackoverflow.com/questions/30297594/uiapplicationlaunchoptionsremotenotificationkey-not-getting-userinfo

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (1)

Collapse
 
acro5piano profile image
Kay Gosho

I solved. Our marketing tool saves data as deeplink, so notification couldn't get the data

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more