inject onNotificationDisplayed with completion handler

This commit is contained in:
Ryan Grey 2018-07-23 16:13:57 +01:00
parent e6cd793f91
commit b6885b0125
1 changed files with 4 additions and 5 deletions

View File

@ -89,9 +89,12 @@ export default class Notifications extends ModuleBase {
// public event name: onNotificationDisplayed
'notifications_notification_displayed',
(notification: NativeNotification) => {
const rnNotification = new Notification(notification);
const done = (fetchResult: string) => getNativeModule(this).complete(rnNotification.notificationId, fetchResult);
SharedEventEmitter.emit(
'onNotificationDisplayed',
new Notification(notification)
rnNotification,
done
);
}
);
@ -200,10 +203,6 @@ export default class Notifications extends ModuleBase {
return getNativeModule(this).getScheduledNotifications();
}
complete(handlerId: string, fetchResult: string): Promise<void> {
return getNativeModule(this).complete(handlerId, fetchResult);
}
onNotification(
nextOrObserver: OnNotification | OnNotificationObserver
): () => any {