Browse Source

hacking some weird NativeModules behaviour

Daniel Zlotin 6 years ago
parent
commit
2bb15524e2
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      lib/src/adapters/NativeEventsReceiver.ts

+ 2
- 2
lib/src/adapters/NativeEventsReceiver.ts View File

5
 export class NativeEventsReceiver {
5
 export class NativeEventsReceiver {
6
   private emitter;
6
   private emitter;
7
   constructor() {
7
   constructor() {
8
-    if (NativeModules.RNNEventEmitter) {
8
+    try {
9
       this.emitter = new NativeEventEmitter(NativeModules.RNNEventEmitter);
9
       this.emitter = new NativeEventEmitter(NativeModules.RNNEventEmitter);
10
-    } else {
10
+    } catch (e) {
11
       console.log('Using mock NativeEventEmitter module');
11
       console.log('Using mock NativeEventEmitter module');
12
       this.emitter = {
12
       this.emitter = {
13
         addListener: () => {
13
         addListener: () => {