diff --git a/README.md b/README.md index 275b61da5e380394669b313cd9118cd71c82c406..42cfeec463f672c606043996b663d9bfc4bdc00a 100644 --- a/README.md +++ b/README.md @@ -103,10 +103,11 @@ import com.wix.reactnativenotifications.RNNotificationsPackage; @Override protected List getPackages() { - return Arrays.asList( - new MainReactPackage(), - ... - new RNNotificationsPackage(MainApplication.this), + return Arrays.asList( + new MainReactPackage(), + // ... + new RNNotificationsPackage(MainApplication.this) + ); ``` ### Receiving push notifications diff --git a/example/index.android.js b/example/index.android.js index 24274b15a123906afc0ccca6e71e6a2fdfb9ae16..5681d187c4c646127f6b07d99c8394825bb363aa 100644 --- a/example/index.android.js +++ b/example/index.android.js @@ -89,7 +89,7 @@ class MainComponent extends Component { componentDidMount() { console.log('ReactScreen', 'componentDidMount'); PendingNotifications.getInitialNotification() - .then((notification) => {console.log("getInitialNotification:", notification); this.setState({initialNotification: notification.getData()});}) + .then((notification) => {console.log("getInitialNotification:", notification); this.setState({initialNotification: (notification ? notification.getData() : undefined)});}) .catch((err) => console.error("getInitialNotifiation failed", err)); } diff --git a/index.android.js b/index.android.js index 4d3bca1b2fdaffbcf6b4565aeb4e18f9ef215834..03fbe0d45374b0ae591e111857dce04dc913856e 100644 --- a/index.android.js +++ b/index.android.js @@ -60,7 +60,7 @@ export class PendingNotifications { static getInitialNotification() { return RNNotifications.getInitialNotification() .then((rawNotification) => { - return new NotificationAndroid(rawNotification); + return rawNotification ? new NotificationAndroid(rawNotification) : undefined; }); } }