mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 04:16:00 +08:00
[ReactNative] Put launchOptions in RCTPushNotificationManager
This commit is contained in:
@@ -15,12 +15,10 @@ function renderApplication(RootComponent, initialProps, rootTag) {
|
||||
rootTag,
|
||||
'Expect to have a valid rootTag, instead got ', rootTag
|
||||
);
|
||||
var pushNotification = initialProps.launchOptions &&
|
||||
initialProps.launchOptions.remoteNotification &&
|
||||
new PushNotificationIOS(initialProps.launchOptions.remoteNotification);
|
||||
var initialNotification = PushNotificationIOS.popInitialNotification();
|
||||
React.render(
|
||||
<RootComponent
|
||||
pushNotification={pushNotification}
|
||||
pushNotification={initialNotification}
|
||||
{...initialProps}
|
||||
/>,
|
||||
rootTag
|
||||
|
||||
@@ -5,8 +5,12 @@
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var NativeModules = require('NativeModules');
|
||||
var RCTDeviceEventEmitter = require('RCTDeviceEventEmitter');
|
||||
|
||||
var RCTPushNotificationManager = NativeModules.RCTPushNotificationManager;
|
||||
|
||||
var _initialNotification = RCTPushNotificationManager.initialNotification;
|
||||
var _notifHandlers = {};
|
||||
|
||||
var DEVICE_NOTIF_EVENT = 'remoteNotificationReceived';
|
||||
@@ -30,6 +34,14 @@ class PushNotificationIOS {
|
||||
_notifHandlers[handler] = null;
|
||||
}
|
||||
|
||||
|
||||
static popInitialNotification() {
|
||||
var initialNotification = _initialNotification &&
|
||||
new PushNotificationIOS(_initialNotification);
|
||||
_initialNotification = null;
|
||||
return initialNotification;
|
||||
}
|
||||
|
||||
constructor(nativeNotif) {
|
||||
this._data = {};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user