|
@@ -1,148 +0,0 @@
|
1
|
|
-import React, { Component } from 'react';
|
2
|
|
-import { View, Text, Button } from 'react-native';
|
3
|
|
-
|
4
|
|
-import Navigation from 'react-native-navigation';
|
5
|
|
-
|
6
|
|
-class WelcomeScreen extends Component {
|
7
|
|
- constructor(props) {
|
8
|
|
- super(props);
|
9
|
|
- this.onClickPush = this.onClickPush.bind(this);
|
10
|
|
- this.onShowModal = this.onShowModal.bind(this);
|
11
|
|
- }
|
12
|
|
-
|
13
|
|
- render() {
|
14
|
|
- return (
|
15
|
|
- <View style={styles.root}>
|
16
|
|
- <Text style={styles.h1}>{`React Native Navigation!`}</Text>
|
17
|
|
- <Button title="Switch to tab based app" onPress={this.onClickSwitchToTabs} />
|
18
|
|
- <Button title="Switch to app with side menus" onPress={this.onClickSwitchToSideMenus} />
|
19
|
|
- <Button title="Switch to lifecycle screen" onPress={this.onClickLifecycleScreen} />
|
20
|
|
- <Button title="Push" onPress={this.onClickPush} />
|
21
|
|
-<<<<<<< HEAD
|
22
|
|
- <Button title="Show Modal" onPress={this.onClickPush} />
|
23
|
|
-=======
|
24
|
|
- <Button title="Show Modal" onPress={this.onClickShowModal} />
|
25
|
|
->>>>>>> 886672b24c98bd44fe235b9f4a5084da85b45d8d
|
26
|
|
- <Text style={styles.footer}>{`this.props.id = ${this.props.id}`}</Text>
|
27
|
|
- </View>
|
28
|
|
- );
|
29
|
|
- }
|
30
|
|
-
|
31
|
|
- onClickSwitchToTabs() {
|
32
|
|
- Navigation.setRoot({
|
33
|
|
- tabs: [
|
34
|
|
- {
|
35
|
|
- container: {
|
36
|
|
- name: 'navigation.playground.SimpleScreen',
|
37
|
|
- passProps: {
|
38
|
|
- text: 'This is tab 1',
|
39
|
|
- myFunction: () => 'Hello from a function!'
|
40
|
|
- }
|
41
|
|
- }
|
42
|
|
- },
|
43
|
|
- {
|
44
|
|
- container: {
|
45
|
|
- name: 'navigation.playground.SimpleScreen',
|
46
|
|
- passProps: {
|
47
|
|
- text: 'This is tab 2'
|
48
|
|
- }
|
49
|
|
- }
|
50
|
|
- }
|
51
|
|
- ]
|
52
|
|
- });
|
53
|
|
- }
|
54
|
|
-
|
55
|
|
- onClickSwitchToSideMenus() {
|
56
|
|
- Navigation.setRoot({
|
57
|
|
- tabs: [
|
58
|
|
- {
|
59
|
|
- container: {
|
60
|
|
- name: 'navigation.playground.SimpleScreen',
|
61
|
|
- passProps: {
|
62
|
|
- text: 'This is a side menu center screen'
|
63
|
|
- }
|
64
|
|
- }
|
65
|
|
- },
|
66
|
|
- {
|
67
|
|
- container: {
|
68
|
|
- name: 'navigation.playground.SimpleScreen'
|
69
|
|
- }
|
70
|
|
- },
|
71
|
|
- {
|
72
|
|
- container: {
|
73
|
|
- name: 'navigation.playground.SimpleScreen'
|
74
|
|
- }
|
75
|
|
- }
|
76
|
|
- ],
|
77
|
|
- sideMenu: {
|
78
|
|
- left: {
|
79
|
|
- container: {
|
80
|
|
- name: 'navigation.playground.SimpleScreen',
|
81
|
|
- passProps: {
|
82
|
|
- text: 'This is a side menu screen'
|
83
|
|
- }
|
84
|
|
- }
|
85
|
|
- },
|
86
|
|
- right: {
|
87
|
|
- container: {
|
88
|
|
- name: 'navigation.playground.SimpleScreen'
|
89
|
|
- }
|
90
|
|
- }
|
91
|
|
- }
|
92
|
|
- });
|
93
|
|
- }
|
94
|
|
-
|
95
|
|
- onClickPush() {
|
96
|
|
- Navigation.on(this.props.id).push({
|
97
|
|
- name: 'navigation.playground.SimpleScreen',
|
98
|
|
- passProps: {
|
99
|
|
- text: 'Pushed screen',
|
100
|
|
- stackPosition: 1
|
101
|
|
- }
|
102
|
|
- });
|
103
|
|
- }
|
104
|
|
-
|
105
|
|
- onClickLifecycleScreen() {
|
106
|
|
- Navigation.setRoot({
|
107
|
|
- container: {
|
108
|
|
- name: 'navigation.playground.LifecycleScreen'
|
109
|
|
- }
|
110
|
|
- });
|
111
|
|
- }
|
112
|
|
-<<<<<<< HEAD
|
113
|
|
-
|
114
|
|
- onShowModal() {
|
115
|
|
- Navigation.on(this.props.id).show
|
116
|
|
-=======
|
117
|
|
-
|
118
|
|
- onClickShowModal() {
|
119
|
|
- Navigation.showModal({
|
120
|
|
- name: 'navigation.playground.SimpleScreen',
|
121
|
|
- passProps: {
|
122
|
|
- text: 'Modal screen'
|
123
|
|
- }
|
124
|
|
- });
|
125
|
|
->>>>>>> 886672b24c98bd44fe235b9f4a5084da85b45d8d
|
126
|
|
- }
|
127
|
|
-}
|
128
|
|
-
|
129
|
|
-export default WelcomeScreen;
|
130
|
|
-
|
131
|
|
-const styles = {
|
132
|
|
- root: {
|
133
|
|
- flexGrow: 1,
|
134
|
|
- justifyContent: 'center',
|
135
|
|
- alignItems: 'center',
|
136
|
|
- backgroundColor: '#f5fcff'
|
137
|
|
- },
|
138
|
|
- h1: {
|
139
|
|
- fontSize: 24,
|
140
|
|
- textAlign: 'center',
|
141
|
|
- margin: 30
|
142
|
|
- },
|
143
|
|
- footer: {
|
144
|
|
- fontSize: 10,
|
145
|
|
- color: '#888',
|
146
|
|
- marginTop: 80
|
147
|
|
- }
|
148
|
|
-};
|