From 9c9425b74b13324665bcdbc9cccb8a1229af2cbe Mon Sep 17 00:00:00 2001 From: Ibrahim Ali Date: Thu, 16 Apr 2020 19:29:01 +0200 Subject: [PATCH] Update event emitter --- index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 319fff8..8df3869 100644 --- a/index.js +++ b/index.js @@ -1,22 +1,23 @@ -import { NativeModules, NativeAppEventEmitter, Platform } from 'react-native'; +import { NativeModules, NativeEventEmitter, Platform } from 'react-native'; const RNPushbotsModule = NativeModules.Pushbots; const not_handlers = new Map(); +const eventEmitter = new NativeEventEmitter(RNPushbotsModule); export default class Pushbots { static addEventListener(type: any, handler: Function) { var listener; if (type === 'received') { - listener = NativeAppEventEmitter.addListener( + listener = eventEmitter.addListener( 'Pushbots__RemoteNotificationReceived', (notification) => { handler(notification); } ); }else if (type === 'opened') { - listener = NativeAppEventEmitter.addListener( + listener = eventEmitter.addListener( 'Pushbots__RemoteNotificationOpened', (notification) => { handler(notification);