|
@@ -2,12 +2,18 @@ import React, {
|
2
|
2
|
Text,
|
3
|
3
|
View,
|
4
|
4
|
ScrollView,
|
5
|
|
- TouchableOpacity
|
|
5
|
+ TouchableOpacity,
|
|
6
|
+ StyleSheet
|
6
|
7
|
} from 'react-native';
|
7
|
8
|
|
8
|
9
|
// important imports, the magic is here
|
9
|
10
|
import { Navigation, Screen } from 'react-native-navigation';
|
10
|
11
|
|
|
12
|
+// need to import every screen we push
|
|
13
|
+import './PushedScreen';
|
|
14
|
+import './StyledScreen';
|
|
15
|
+import './ModalScreen';
|
|
16
|
+
|
11
|
17
|
// instead of React.Component, we extend Screen (imported above)
|
12
|
18
|
class ThirdTabScreen extends Screen {
|
13
|
19
|
constructor(props) {
|
|
@@ -16,11 +22,51 @@ class ThirdTabScreen extends Screen {
|
16
|
22
|
render() {
|
17
|
23
|
return (
|
18
|
24
|
<View style={{flex: 1, padding: 20}}>
|
19
|
|
- <Text>Third Tab Screen</Text>
|
|
25
|
+
|
|
26
|
+ <TouchableOpacity onPress={ this.onPushPress.bind(this) }>
|
|
27
|
+ <Text style={styles.button}>Push Plain Screen</Text>
|
|
28
|
+ </TouchableOpacity>
|
|
29
|
+
|
|
30
|
+ <TouchableOpacity onPress={ this.onPushStyledPress.bind(this) }>
|
|
31
|
+ <Text style={styles.button}>Push Styled Screen</Text>
|
|
32
|
+ </TouchableOpacity>
|
|
33
|
+
|
|
34
|
+ <TouchableOpacity onPress={ this.onModalPress.bind(this) }>
|
|
35
|
+ <Text style={styles.button}>Show Modal Screen</Text>
|
|
36
|
+ </TouchableOpacity>
|
|
37
|
+
|
20
|
38
|
</View>
|
21
|
39
|
);
|
22
|
40
|
}
|
|
41
|
+ onPushPress() {
|
|
42
|
+ this.navigator.push({
|
|
43
|
+ title: "More",
|
|
44
|
+ screen: "example.PushedScreen"
|
|
45
|
+ });
|
|
46
|
+ }
|
|
47
|
+ onPushStyledPress() {
|
|
48
|
+ this.navigator.push({
|
|
49
|
+ title: "Styled",
|
|
50
|
+ screen: "example.StyledScreen"
|
|
51
|
+ });
|
|
52
|
+ }
|
|
53
|
+ onModalPress() {
|
|
54
|
+ this.navigator.showModal({
|
|
55
|
+ title: "Modal",
|
|
56
|
+ screen: "example.ModalScreen"
|
|
57
|
+ });
|
|
58
|
+ }
|
23
|
59
|
}
|
24
|
60
|
|
|
61
|
+const styles = StyleSheet.create({
|
|
62
|
+ button: {
|
|
63
|
+ textAlign: 'center',
|
|
64
|
+ fontSize: 18,
|
|
65
|
+ marginBottom: 10,
|
|
66
|
+ marginTop:10,
|
|
67
|
+ color: 'blue'
|
|
68
|
+ }
|
|
69
|
+});
|
|
70
|
+
|
25
|
71
|
// every screen must be registered with a unique name
|
26
|
72
|
Navigation.registerScreen('example.ThirdTabScreen', () => ThirdTabScreen);
|