|
@@ -3,19 +3,18 @@ import utils from './utils';
|
3
|
3
|
|
4
|
4
|
import {
|
5
|
5
|
RctActivity
|
6
|
|
-} from 'react-native-controllers';
|
|
6
|
+} from 'react-native-navigation';
|
7
|
7
|
|
8
|
8
|
function startSingleScreenApp(params) {
|
9
|
|
- const screen = params.screen;
|
|
9
|
+ let screen = params.screen;
|
10
|
10
|
if (!screen.screen) {
|
11
|
11
|
console.error('startSingleScreenApp(params): screen must include a screen property');
|
12
|
12
|
return;
|
13
|
13
|
}
|
14
|
14
|
|
15
|
|
- console.warn('startSingleScreenApp not implemented yet');
|
16
|
|
- // RctActivity.startSingleScreenApp(params);
|
17
|
|
- // add screenInstanceID using random
|
18
|
|
-
|
|
15
|
+ console.log(RctActivity);
|
|
16
|
+ addNavigationParams(screen);
|
|
17
|
+ RctActivity.startSingleScreenApp(screen);
|
19
|
18
|
}
|
20
|
19
|
|
21
|
20
|
function startTabBasedApp(params) {
|
|
@@ -24,22 +23,25 @@ function startTabBasedApp(params) {
|
24
|
23
|
return;
|
25
|
24
|
}
|
26
|
25
|
|
27
|
|
- // Add stackID for each tab
|
28
|
|
- // TODO: Add propper documentation + switch to UUID? -guy
|
29
|
26
|
params.tabs.forEach(function (tab, idx) {
|
30
|
|
- tab.stackID = utils.getRandomId();
|
31
|
|
- tab.navigatorID = utils.getRandomId() + '_nav' + idx;
|
32
|
|
- tab.screenInstanceID = utils.getRandomId();
|
33
|
|
- tab.navigatorEventID = tab.screenInstanceID + '_events';
|
|
27
|
+ addNavigationParams(tab, idx)
|
34
|
28
|
});
|
35
|
29
|
|
36
|
30
|
RctActivity.startTabBasedApp(params.tabs);
|
37
|
31
|
}
|
38
|
32
|
|
39
|
33
|
function navigatorPush(navigator, params) {
|
|
34
|
+ addNavigationParams(params)
|
40
|
35
|
RctActivity.navigatorPush(params);
|
41
|
36
|
}
|
42
|
37
|
|
|
38
|
+function addNavigationParams(screen, idx = '') {
|
|
39
|
+ screen.stackID = utils.getRandomId();
|
|
40
|
+ screen.navigatorID = utils.getRandomId() + '_nav' + idx;
|
|
41
|
+ screen.screenInstanceID = utils.getRandomId();
|
|
42
|
+ screen.navigatorEventID = screen.screenInstanceID + '_events';
|
|
43
|
+}
|
|
44
|
+
|
43
|
45
|
export default {
|
44
|
46
|
startSingleScreenApp,
|
45
|
47
|
startTabBasedApp,
|