Fix receiving notifications on Android

TypeError: undefined is not an object (evaluating 'notifications.ios')

https://github.com/invertase/react-native-firebase/issues/1445
This commit is contained in:
Dmitry Novotochinov 2018-09-04 17:31:33 +03:00
parent 4afed7f121
commit 46951bf438
No known key found for this signature in database
GPG Key ID: 43D1DAF5AD39C927
1 changed files with 12 additions and 9 deletions

View File

@ -51,15 +51,18 @@ export default class Notification {
this._title = nativeNotification.title;
}
this._android = new AndroidNotification(
this,
nativeNotification && nativeNotification.android
);
this._ios = new IOSNotification(
this,
notifications,
nativeNotification && nativeNotification.ios
);
if(Platform.OS === 'ios'){
this._ios = new IOSNotification(
this,
notifications,
nativeNotification && nativeNotification.ios
);
} else {
this._android = new AndroidNotification(
this,
nativeNotification && nativeNotification.android
);
}
// Defaults
this._data = this._data || {};