Browse Source

registerForAllComponents

Daniel Zlotin 6 years ago
parent
commit
1443f36863
1 changed files with 6 additions and 3 deletions
  1. 6
    3
      lib/src/Navigation.ts

+ 6
- 3
lib/src/Navigation.ts View File

9
 import { EventsRegistry } from './events/EventsRegistry';
9
 import { EventsRegistry } from './events/EventsRegistry';
10
 import { ComponentProvider } from 'react-native';
10
 import { ComponentProvider } from 'react-native';
11
 import { Element } from './adapters/Element';
11
 import { Element } from './adapters/Element';
12
+import { ComponentEventsRegistry } from './events/ComponentEventsRegistry';
12
 
13
 
13
 export class Navigation {
14
 export class Navigation {
14
   public readonly Element;
15
   public readonly Element;
21
   private readonly layoutTreeCrawler;
22
   private readonly layoutTreeCrawler;
22
   private readonly nativeCommandsSender;
23
   private readonly nativeCommandsSender;
23
   private readonly commands;
24
   private readonly commands;
24
-  private readonly publicEventsRegistry;
25
+  private readonly eventsRegistry;
25
 
26
 
26
   constructor() {
27
   constructor() {
27
     this.Element = Element;
28
     this.Element = Element;
34
     this.layoutTreeCrawler = new LayoutTreeCrawler(this.uniqueIdProvider, this.store);
35
     this.layoutTreeCrawler = new LayoutTreeCrawler(this.uniqueIdProvider, this.store);
35
     this.nativeCommandsSender = new NativeCommandsSender();
36
     this.nativeCommandsSender = new NativeCommandsSender();
36
     this.commands = new Commands(this.nativeCommandsSender, this.layoutTreeParser, this.layoutTreeCrawler);
37
     this.commands = new Commands(this.nativeCommandsSender, this.layoutTreeParser, this.layoutTreeCrawler);
37
-    this.publicEventsRegistry = new EventsRegistry(this.nativeEventsReceiver);
38
+    this.eventsRegistry = new EventsRegistry(this.nativeEventsReceiver);
39
+
40
+    new ComponentEventsRegistry(this.eventsRegistry, this.store).registerForAllComponents();
38
   }
41
   }
39
 
42
 
40
   /**
43
   /**
133
    * Obtain the events registry instance
136
    * Obtain the events registry instance
134
    */
137
    */
135
   public events(): EventsRegistry {
138
   public events(): EventsRegistry {
136
-    return this.publicEventsRegistry;
139
+    return this.eventsRegistry;
137
   }
140
   }
138
 }
141
 }