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,6 +9,7 @@ import { LayoutTreeCrawler } from './commands/LayoutTreeCrawler';
9 9
 import { EventsRegistry } from './events/EventsRegistry';
10 10
 import { ComponentProvider } from 'react-native';
11 11
 import { Element } from './adapters/Element';
12
+import { ComponentEventsRegistry } from './events/ComponentEventsRegistry';
12 13
 
13 14
 export class Navigation {
14 15
   public readonly Element;
@@ -21,7 +22,7 @@ export class Navigation {
21 22
   private readonly layoutTreeCrawler;
22 23
   private readonly nativeCommandsSender;
23 24
   private readonly commands;
24
-  private readonly publicEventsRegistry;
25
+  private readonly eventsRegistry;
25 26
 
26 27
   constructor() {
27 28
     this.Element = Element;
@@ -34,7 +35,9 @@ export class Navigation {
34 35
     this.layoutTreeCrawler = new LayoutTreeCrawler(this.uniqueIdProvider, this.store);
35 36
     this.nativeCommandsSender = new NativeCommandsSender();
36 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,6 +136,6 @@ export class Navigation {
133 136
    * Obtain the events registry instance
134 137
    */
135 138
   public events(): EventsRegistry {
136
-    return this.publicEventsRegistry;
139
+    return this.eventsRegistry;
137 140
   }
138 141
 }