|
@@ -1,197 +0,0 @@
|
1
|
|
-const React = require('react');
|
2
|
|
-const { Component } = require('react');
|
3
|
|
-
|
4
|
|
-const { View, Text, Button } = require('react-native');
|
5
|
|
-
|
6
|
|
-const { Navigation } = require('react-native-navigation');
|
7
|
|
-const testIDs = require('../testIDs');
|
8
|
|
-
|
9
|
|
-class ComplexLayout extends Component {
|
10
|
|
- render() {
|
11
|
|
- return (
|
12
|
|
- <View style={styles.root}>
|
13
|
|
- <Text style={styles.h1} testID={testIDs.CENTERED_TEXT_HEADER}>{this.props.text || 'Complex layout screen'}</Text>
|
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} />
|
17
|
|
- <Button title='Show touch through overlay with scroll' testID={testIDs.SHOW_TOUCH_THROUGH_OVERLAY_SCROLLER} onPress={() => this.onClickShowOverlayWithScroll(true)} />
|
18
|
|
- </View>
|
19
|
|
- );
|
20
|
|
- }
|
21
|
|
-
|
22
|
|
- onExternalComponentInStackPressed = () => {
|
23
|
|
- Navigation.showModal({
|
24
|
|
- stack: {
|
25
|
|
- children: [{
|
26
|
|
- externalComponent: {
|
27
|
|
- name: 'RNNCustomComponent',
|
28
|
|
- passProps: {
|
29
|
|
- text: 'External component in stack'
|
30
|
|
- }
|
31
|
|
- }
|
32
|
|
- }]
|
33
|
|
- }
|
34
|
|
- });
|
35
|
|
- }
|
36
|
|
-
|
37
|
|
- onExternalComponentInDeepStackPressed = () => {
|
38
|
|
- Navigation.showModal({
|
39
|
|
- stack: {
|
40
|
|
- children: [{
|
41
|
|
- component: {
|
42
|
|
- name: 'navigation.playground.TextScreen'
|
43
|
|
- }
|
44
|
|
- },
|
45
|
|
- {
|
46
|
|
- externalComponent: {
|
47
|
|
- name: 'RNNCustomComponent',
|
48
|
|
- passProps: {
|
49
|
|
- text: 'External component in deep stack'
|
50
|
|
- }
|
51
|
|
- }
|
52
|
|
- }]
|
53
|
|
- }
|
54
|
|
- });
|
55
|
|
- }
|
56
|
|
-
|
57
|
|
- onSideMenuLayoutInsideBottomTabPressed = () => {
|
58
|
|
- Navigation.dismissAllModals();
|
59
|
|
- Navigation.setRoot({
|
60
|
|
- root: {
|
61
|
|
- bottomTabs: {
|
62
|
|
- children: [
|
63
|
|
- {
|
64
|
|
- stack: {
|
65
|
|
- children: [
|
66
|
|
- {
|
67
|
|
- component: {
|
68
|
|
- name: 'navigation.playground.TextScreen',
|
69
|
|
- options: {
|
70
|
|
- topBar: {
|
71
|
|
- animate: false
|
72
|
|
- }
|
73
|
|
- }
|
74
|
|
- }
|
75
|
|
- }
|
76
|
|
- ],
|
77
|
|
- options: {
|
78
|
|
- bottomTab: {
|
79
|
|
- text: 'Stack',
|
80
|
|
- icon: require('../images/one.png')
|
81
|
|
- }
|
82
|
|
- }
|
83
|
|
- }
|
84
|
|
- },
|
85
|
|
- {
|
86
|
|
- sideMenu: {
|
87
|
|
- left: {
|
88
|
|
- component: {
|
89
|
|
- name: 'navigation.playground.SideMenuScreen',
|
90
|
|
- options: {
|
91
|
|
- topBar: {
|
92
|
|
- animate: false
|
93
|
|
- }
|
94
|
|
- },
|
95
|
|
- passProps: {
|
96
|
|
- side: 'left'
|
97
|
|
- }
|
98
|
|
- }
|
99
|
|
- },
|
100
|
|
- center: {
|
101
|
|
- stack: {
|
102
|
|
- children: [
|
103
|
|
- {
|
104
|
|
- component: {
|
105
|
|
- name: 'complexLayout.bottomTabThatOpensSideMenu'
|
106
|
|
- }
|
107
|
|
- }
|
108
|
|
- ]
|
109
|
|
- }
|
110
|
|
- },
|
111
|
|
- options: {
|
112
|
|
- bottomTab: {
|
113
|
|
- text: 'SideMenu',
|
114
|
|
- icon: require('../images/two.png'),
|
115
|
|
- testID: testIDs.SECOND_TAB_BAR_BUTTON
|
116
|
|
- }
|
117
|
|
- }
|
118
|
|
- }
|
119
|
|
- },
|
120
|
|
- {
|
121
|
|
- sideMenu: {
|
122
|
|
- left: {
|
123
|
|
- component: {
|
124
|
|
- name: 'navigation.playground.SideMenuScreen',
|
125
|
|
- passProps: {
|
126
|
|
- side: 'left'
|
127
|
|
- }
|
128
|
|
- }
|
129
|
|
- },
|
130
|
|
- center: {
|
131
|
|
- stack: {
|
132
|
|
- children: [
|
133
|
|
- {
|
134
|
|
- component: {
|
135
|
|
- name: 'navigation.playground.FlatListScreen',
|
136
|
|
- }
|
137
|
|
- }
|
138
|
|
- ]
|
139
|
|
- }
|
140
|
|
- },
|
141
|
|
- options: {
|
142
|
|
- bottomTab: {
|
143
|
|
- text: 'FlatList',
|
144
|
|
- icon: require('../images/three.png'),
|
145
|
|
- testID: testIDs.THIRD_TAB_BAR_BUTTON,
|
146
|
|
- }
|
147
|
|
- }
|
148
|
|
- }
|
149
|
|
- }
|
150
|
|
- ]
|
151
|
|
- }
|
152
|
|
- }
|
153
|
|
- });
|
154
|
|
- }
|
155
|
|
-
|
156
|
|
- onClickShowOverlayWithScroll = async (interceptTouchOutside) => {
|
157
|
|
- await Navigation.showOverlay({
|
158
|
|
- component: {
|
159
|
|
- name: 'navigation.playground.CustomDialogWithScroll',
|
160
|
|
- options: {
|
161
|
|
- layout: {
|
162
|
|
- componentBackgroundColor: 'transparent'
|
163
|
|
- },
|
164
|
|
- overlay: {
|
165
|
|
- interceptTouchOutside
|
166
|
|
- }
|
167
|
|
- }
|
168
|
|
- }
|
169
|
|
- });
|
170
|
|
- }
|
171
|
|
-}
|
172
|
|
-
|
173
|
|
-module.exports = ComplexLayout;
|
174
|
|
-
|
175
|
|
-const styles = {
|
176
|
|
- root: {
|
177
|
|
- flexGrow: 1,
|
178
|
|
- justifyContent: 'center',
|
179
|
|
- alignItems: 'center',
|
180
|
|
- backgroundColor: '#f5fcff'
|
181
|
|
- },
|
182
|
|
- h1: {
|
183
|
|
- fontSize: 24,
|
184
|
|
- textAlign: 'center',
|
185
|
|
- margin: 10
|
186
|
|
- },
|
187
|
|
- h2: {
|
188
|
|
- fontSize: 12,
|
189
|
|
- textAlign: 'center',
|
190
|
|
- margin: 10
|
191
|
|
- },
|
192
|
|
- footer: {
|
193
|
|
- fontSize: 10,
|
194
|
|
- color: '#888',
|
195
|
|
- marginTop: 10
|
196
|
|
- }
|
197
|
|
-};
|