|
@@ -11,30 +11,24 @@ import { ComponentProvider } from 'react-native';
|
11
|
11
|
import { Element } from './adapters/Element';
|
12
|
12
|
import { ComponentEventsObserver } from './events/ComponentEventsObserver';
|
13
|
13
|
import { CommandsObserver } from './events/CommandsObserver';
|
14
|
|
-import { Constants } from './constants/Constants';
|
15
|
|
-import { NativeModules } from 'react-native';
|
16
|
|
-
|
17
|
|
-const NavigationModule = NativeModules.RNNBridgeModule;
|
|
14
|
+import { Constants } from './adapters/Constants';
|
18
|
15
|
|
19
|
16
|
export class Navigation {
|
20
|
17
|
public readonly Element: React.ComponentType<{ elementId: any; resizeMode: any; }>;
|
21
|
|
- public readonly constants = new Constants(NavigationModule);
|
22
|
|
-
|
23
|
|
- private readonly store;
|
24
|
|
- private readonly nativeEventsReceiver;
|
25
|
|
- private readonly uniqueIdProvider;
|
26
|
|
- private readonly componentRegistry;
|
27
|
|
- private readonly layoutTreeParser;
|
28
|
|
- private readonly layoutTreeCrawler;
|
29
|
|
- private readonly nativeCommandsSender;
|
30
|
|
- private readonly commands;
|
31
|
|
- private readonly eventsRegistry;
|
32
|
|
- private readonly commandsObserver;
|
33
|
|
- private readonly componentEventsObserver;
|
|
18
|
+ public readonly store: Store;
|
|
19
|
+ private readonly nativeEventsReceiver: NativeEventsReceiver;
|
|
20
|
+ private readonly uniqueIdProvider: UniqueIdProvider;
|
|
21
|
+ private readonly componentRegistry: ComponentRegistry;
|
|
22
|
+ private readonly layoutTreeParser: LayoutTreeParser;
|
|
23
|
+ private readonly layoutTreeCrawler: LayoutTreeCrawler;
|
|
24
|
+ private readonly nativeCommandsSender: NativeCommandsSender;
|
|
25
|
+ private readonly commands: Commands;
|
|
26
|
+ private readonly eventsRegistry: EventsRegistry;
|
|
27
|
+ private readonly commandsObserver: CommandsObserver;
|
|
28
|
+ private readonly componentEventsObserver: ComponentEventsObserver;
|
34
|
29
|
|
35
|
30
|
constructor() {
|
36
|
31
|
this.Element = Element;
|
37
|
|
-
|
38
|
32
|
this.store = new Store();
|
39
|
33
|
this.nativeEventsReceiver = new NativeEventsReceiver();
|
40
|
34
|
this.uniqueIdProvider = new UniqueIdProvider();
|
|
@@ -54,8 +48,8 @@ export class Navigation {
|
54
|
48
|
* Every navigation component in your app must be registered with a unique name.
|
55
|
49
|
* The component itself is a traditional React component extending React.Component.
|
56
|
50
|
*/
|
57
|
|
- public registerComponent(componentName: string, getComponentClassFunc: ComponentProvider): React.ComponentType<any> {
|
58
|
|
- return this.componentRegistry.registerComponent(componentName, getComponentClassFunc);
|
|
51
|
+ public registerComponent(componentName: string, getComponentClassFunc: ComponentProvider): void {
|
|
52
|
+ this.componentRegistry.registerComponent(componentName, getComponentClassFunc);
|
59
|
53
|
}
|
60
|
54
|
|
61
|
55
|
/**
|
|
@@ -155,4 +149,11 @@ export class Navigation {
|
155
|
149
|
public events(): EventsRegistry {
|
156
|
150
|
return this.eventsRegistry;
|
157
|
151
|
}
|
|
152
|
+
|
|
153
|
+ /**
|
|
154
|
+ * Constants coming from native
|
|
155
|
+ */
|
|
156
|
+ public constants(): Constants {
|
|
157
|
+ return Constants.get();
|
|
158
|
+ }
|
158
|
159
|
}
|