|
@@ -1,17 +1,17 @@
|
1
|
1
|
import React, {Component} from 'react';
|
2
|
2
|
import {AppRegistry, NativeModules} from 'react-native';
|
3
|
|
-
|
|
3
|
+import _ from 'lodash';
|
4
|
4
|
import PropRegistry from './PropRegistry';
|
5
|
5
|
|
6
|
6
|
const NativeReactModule = NativeModules.NavigationReactModule;
|
7
|
7
|
|
8
|
8
|
function startApp(activityParams) {
|
9
|
|
- PropRegistry.save(activityParams.screen.navigationParams.screenInstanceID, activityParams.screen.passProps);
|
|
9
|
+ savePassProps(activityParams);
|
10
|
10
|
NativeReactModule.startApp(activityParams);
|
11
|
11
|
}
|
12
|
12
|
|
13
|
13
|
function push(screenParams) {
|
14
|
|
- PropRegistry.save(screenParams.navigationParams.screenInstanceID, screenParams.passProps);
|
|
14
|
+ savePassProps(screenParams);
|
15
|
15
|
NativeReactModule.push(screenParams);
|
16
|
16
|
}
|
17
|
17
|
|
|
@@ -24,7 +24,7 @@ function popToRoot(screenParams) {
|
24
|
24
|
}
|
25
|
25
|
|
26
|
26
|
function newStack(screenParams) {
|
27
|
|
- PropRegistry.save(screenParams.navigationParams.screenInstanceID, screenParams.passProps);
|
|
27
|
+ savePassProps(screenParams);
|
28
|
28
|
NativeReactModule.newStack(screenParams);
|
29
|
29
|
}
|
30
|
30
|
|
|
@@ -45,7 +45,7 @@ function setScreenTitleBarButtons(screenInstanceID, navigatorEventID, rightButto
|
45
|
45
|
}
|
46
|
46
|
|
47
|
47
|
function showModal(screenParams) {
|
48
|
|
- PropRegistry.save(screenParams.navigationParams.screenInstanceID, screenParams.passProps);
|
|
48
|
+ savePassProps(screenParams);
|
49
|
49
|
NativeReactModule.showModal(screenParams);
|
50
|
50
|
}
|
51
|
51
|
|
|
@@ -57,6 +57,30 @@ function dismissAllModals() {
|
57
|
57
|
NativeReactModule.dismissAllModals();
|
58
|
58
|
}
|
59
|
59
|
|
|
60
|
+function savePassProps(params) {
|
|
61
|
+ //TODO this needs to be handled in a common place,
|
|
62
|
+ //TODO also, all global passProps should be handled differently
|
|
63
|
+ //TODO also, topTabs passProps not working
|
|
64
|
+ if (params.navigationParams && params.passProps) {
|
|
65
|
+ PropRegistry.save(params.navigationParams.screenInstanceID, params.passProps);
|
|
66
|
+ }
|
|
67
|
+
|
|
68
|
+ if (params.screen && params.screen.passProps) {
|
|
69
|
+ PropRegistry.save(params.screen.navigationParams.screenInstanceID, params.screen.passProps);
|
|
70
|
+ }
|
|
71
|
+
|
|
72
|
+ if (_.get(params, 'screen.topTabs')) {
|
|
73
|
+ _.forEach(params.screen.topTabs, (tab) => savePassProps(tab));
|
|
74
|
+ }
|
|
75
|
+
|
|
76
|
+ if (params.tabs) {
|
|
77
|
+ _.forEach(params.tabs, (tab) => {
|
|
78
|
+ tab.passProps = params.passProps;
|
|
79
|
+ savePassProps(tab);
|
|
80
|
+ });
|
|
81
|
+ }
|
|
82
|
+}
|
|
83
|
+
|
60
|
84
|
module.exports = {
|
61
|
85
|
startApp,
|
62
|
86
|
push,
|