|
@@ -7,22 +7,18 @@ const { Navigation } = require('react-native-navigation');
|
7
|
7
|
const testIDs = require('../testIDs');
|
8
|
8
|
|
9
|
9
|
class ComplexLayout extends Component {
|
10
|
|
- constructor(props) {
|
11
|
|
- super(props);
|
12
|
|
- }
|
13
|
|
-
|
14
|
10
|
render() {
|
15
|
11
|
return (
|
16
|
12
|
<View style={styles.root}>
|
17
|
13
|
<Text style={styles.h1} testID={testIDs.CENTERED_TEXT_HEADER}>{this.props.text || 'Complex layout screen'}</Text>
|
18
|
|
- <Button title={'External component in stack'} testID={testIDs.EXTERNAL_COMPONENT_IN_STACK} onPress={() => this.onExternalComponentInStackPressed()} />
|
19
|
|
- <Button title={'External component in deep stack'} testID={testIDs.EXTERNAL_COMPONENT_IN_DEEP_STACK} onPress={() => this.onExternalComponentInDeepStackPressed()} />
|
20
|
|
- <Button title={'Sidemenu layout inside a bottomTab'} testID={testIDs.SIDE_MENU_LAYOUT_INSIDE_BOTTOM_TAB} onPress={() => this.onSideMenuLayoutInsideBottomTabPressed()} />
|
|
14
|
+ <Button title={'External component in stack'} testID={testIDs.EXTERNAL_COMPONENT_IN_STACK} onPress={this.onExternalComponentInStackPressed} />
|
|
15
|
+ <Button title={'External component in deep stack'} testID={testIDs.EXTERNAL_COMPONENT_IN_DEEP_STACK} onPress={this.onExternalComponentInDeepStackPressed} />
|
|
16
|
+ <Button title={'SideMenu layout inside a bottomTab'} testID={testIDs.SIDE_MENU_LAYOUT_INSIDE_BOTTOM_TAB} onPress={this.onSideMenuLayoutInsideBottomTabPressed} />
|
21
|
17
|
</View>
|
22
|
18
|
);
|
23
|
19
|
}
|
24
|
20
|
|
25
|
|
- onExternalComponentInStackPressed() {
|
|
21
|
+ onExternalComponentInStackPressed = () => {
|
26
|
22
|
Navigation.showModal({
|
27
|
23
|
stack: {
|
28
|
24
|
children: [{
|
|
@@ -37,7 +33,7 @@ class ComplexLayout extends Component {
|
37
|
33
|
});
|
38
|
34
|
}
|
39
|
35
|
|
40
|
|
- onExternalComponentInDeepStackPressed() {
|
|
36
|
+ onExternalComponentInDeepStackPressed = () => {
|
41
|
37
|
Navigation.showModal({
|
42
|
38
|
stack: {
|
43
|
39
|
children: [{
|
|
@@ -57,7 +53,7 @@ class ComplexLayout extends Component {
|
57
|
53
|
});
|
58
|
54
|
}
|
59
|
55
|
|
60
|
|
- onSideMenuLayoutInsideBottomTabPressed() {
|
|
56
|
+ onSideMenuLayoutInsideBottomTabPressed = () => {
|
61
|
57
|
Navigation.dismissAllModals();
|
62
|
58
|
Navigation.setRoot({
|
63
|
59
|
root: {
|
|
@@ -68,44 +64,47 @@ class ComplexLayout extends Component {
|
68
|
64
|
children: [
|
69
|
65
|
{
|
70
|
66
|
component: {
|
71
|
|
- name: 'navigation.playground.TextScreen',
|
72
|
|
- },
|
73
|
|
- },
|
|
67
|
+ name: 'navigation.playground.TextScreen'
|
|
68
|
+ }
|
|
69
|
+ }
|
74
|
70
|
],
|
75
|
71
|
options: {
|
76
|
72
|
bottomTab: {
|
77
|
73
|
text: 'Stack',
|
78
|
|
- icon: require('../images/one.png'),
|
79
|
|
- },
|
80
|
|
- },
|
81
|
|
- },
|
|
74
|
+ icon: require('../images/one.png')
|
|
75
|
+ }
|
|
76
|
+ }
|
|
77
|
+ }
|
82
|
78
|
},
|
83
|
79
|
{
|
84
|
80
|
sideMenu: {
|
85
|
81
|
left: {
|
86
|
82
|
component: {
|
87
|
83
|
name: 'navigation.playground.SideMenuScreen',
|
88
|
|
- },
|
|
84
|
+ passProps: {
|
|
85
|
+ side: 'left'
|
|
86
|
+ }
|
|
87
|
+ }
|
89
|
88
|
},
|
90
|
89
|
center: {
|
91
|
90
|
stack: {
|
92
|
91
|
children: [
|
93
|
92
|
{
|
94
|
93
|
component: {
|
95
|
|
- name: 'navigation.playground.TextScreen',
|
96
|
|
- },
|
97
|
|
- },
|
98
|
|
- ],
|
99
|
|
- },
|
|
94
|
+ name: 'complexLayout.bottomTabThatOpensSideMenu'
|
|
95
|
+ }
|
|
96
|
+ }
|
|
97
|
+ ]
|
|
98
|
+ }
|
100
|
99
|
},
|
101
|
100
|
options: {
|
102
|
101
|
bottomTab: {
|
103
|
102
|
text: 'SideMenu',
|
104
|
|
- icon: require('../images/two.png'),
|
105
|
|
- },
|
106
|
|
- },
|
107
|
|
- },
|
108
|
|
- },
|
|
103
|
+ icon: require('../images/two.png')
|
|
104
|
+ }
|
|
105
|
+ }
|
|
106
|
+ }
|
|
107
|
+ }
|
109
|
108
|
]
|
110
|
109
|
}
|
111
|
110
|
}
|