|
@@ -0,0 +1,85 @@
|
|
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
|
+
|
|
10
|
+class ComplexLayout extends Component {
|
|
11
|
+ constructor(props) {
|
|
12
|
+ super(props);
|
|
13
|
+ }
|
|
14
|
+
|
|
15
|
+ render() {
|
|
16
|
+ return (
|
|
17
|
+ <View style={styles.root}>
|
|
18
|
+ <Text style={styles.h1} testID={testIDs.CENTERED_TEXT_HEADER}>{this.props.text || 'Complex layout screen'}</Text>
|
|
19
|
+ <Button title={'External component in stack'} testID={testIDs.EXTERNAL_COMPONENT_IN_STACK} onPress={() => this.onExternalComponentInStackPressed()} />
|
|
20
|
+ <Button title={'External component in deep stack'} testID={testIDs.EXTERNAL_COMPONENT_IN_DEEP_STACK} onPress={() => this.onExternalComponentInDeepStackPressed()} />
|
|
21
|
+ </View>
|
|
22
|
+ );
|
|
23
|
+ }
|
|
24
|
+
|
|
25
|
+ onExternalComponentInStackPressed() {
|
|
26
|
+ Navigation.showModal({
|
|
27
|
+ stack: {
|
|
28
|
+ children: [{
|
|
29
|
+ externalComponent: {
|
|
30
|
+ name: 'RNNCustomComponent',
|
|
31
|
+ passProps: {
|
|
32
|
+ text: 'External component in stack'
|
|
33
|
+ }
|
|
34
|
+ }
|
|
35
|
+ }]
|
|
36
|
+ }
|
|
37
|
+ });
|
|
38
|
+ }
|
|
39
|
+
|
|
40
|
+ onExternalComponentInDeepStackPressed() {
|
|
41
|
+ Navigation.showModal({
|
|
42
|
+ stack: {
|
|
43
|
+ children: [{
|
|
44
|
+ component: {
|
|
45
|
+ name: 'navigation.playground.TextScreen'
|
|
46
|
+ }
|
|
47
|
+ },
|
|
48
|
+ {
|
|
49
|
+ externalComponent: {
|
|
50
|
+ name: 'RNNCustomComponent',
|
|
51
|
+ passProps: {
|
|
52
|
+ text: 'External component in deep stack'
|
|
53
|
+ }
|
|
54
|
+ }
|
|
55
|
+ }]
|
|
56
|
+ }
|
|
57
|
+ });
|
|
58
|
+ }
|
|
59
|
+}
|
|
60
|
+
|
|
61
|
+module.exports = ComplexLayout;
|
|
62
|
+
|
|
63
|
+const styles = {
|
|
64
|
+ root: {
|
|
65
|
+ flexGrow: 1,
|
|
66
|
+ justifyContent: 'center',
|
|
67
|
+ alignItems: 'center',
|
|
68
|
+ backgroundColor: '#f5fcff'
|
|
69
|
+ },
|
|
70
|
+ h1: {
|
|
71
|
+ fontSize: 24,
|
|
72
|
+ textAlign: 'center',
|
|
73
|
+ margin: 10
|
|
74
|
+ },
|
|
75
|
+ h2: {
|
|
76
|
+ fontSize: 12,
|
|
77
|
+ textAlign: 'center',
|
|
78
|
+ margin: 10
|
|
79
|
+ },
|
|
80
|
+ footer: {
|
|
81
|
+ fontSize: 10,
|
|
82
|
+ color: '#888',
|
|
83
|
+ marginTop: 10
|
|
84
|
+ }
|
|
85
|
+};
|