forked from CS6/srp_console
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
315 lines (263 loc) · 6.32 KB
/
App.js
File metadata and controls
315 lines (263 loc) · 6.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow
*/
import React, { Component } from 'react';
import { Platform,
StyleSheet,
View,
Text,
Image,
Dimensions,
ScrollView,
TextInput,
Button,
TouchableOpacity,
Linking,
} from 'react-native';
const { width, height } = Dimensions.get('window');
import { createBottomTabNavigator, SafeAreaView,createSwitchNavigator, createStackNavigator,withNavigation } from 'react-navigation';
// import Mian from './mian_vue';
import Mian from './app/index';
import Setup from './app/page/registered/Setup';
import QRvue from './app/page/qrcode/QRvue';
import Btn_Qrcode from './app/page/home/Btn_Qrcode';
import Btn_Search from './app/page/home/Btn_Search';
import Btn_Remind from './app/page/home/Btn_Remind';
import Login_index from './Login_index';
const instructions = Platform.select({
ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or59487 shake for dev menu',
android:
'Double tap R on your keyboard 9487to reload,\n' +
'Shake or press menu button for dev menu',
});
type Props = {};
class DetailsScreen extends React.Component {
static navigationOptions = {
// headerTitle instead of title
// headerTitle: <Top />,
title: 'Details',
};
render() {
return (
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
<Text>Details Screen</Text>
<Button
title="GoBack"
onPress={() => this.props.navigation.goBack().Alert("hi")}
/>
<Button
title="console"
onPress={() => console.warn(this.props)
}
/>
</View>
);
}
}
class MyBackButton extends React.Component {
render() {
return <Button title="Back" onPress={() => { this.props.navigation.push('Details')}} />;
}
}
class Welcome extends React.Component {
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
Welcome
</Text>
<Button
title='go'
onPress={() => { this.props.navigation.navigate('Welcome1') }}
/>
</View>
);
}
}
class Welcome1 extends React.Component {
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
Welcome1
</Text>
<Button
title='go'
onPress={() => { this.props.navigation.navigate('Login') }}
/>
</View>
);
}
}
// export default withNavigation(MyBackButton);
class HomeScreen extends React.Component {
static navigationOptions = {
// headerTitle instead of title
// tabBarComponent: <TTOOPP />,
headerTitle:<Btn_Search/>,
// headerTitle:<Text >FUCK</Text>,
headerStyle: {
// backgroundColor: '#f4511e',
backgroundColor: '#7592A9',
///上方tab bar 顏色 iphone X 上瀏海 顏色
activeTintColor: '#2562b4',
},
indicatorStyle: {
height: 1,
}, // android 中TabBar下面会显示一条线,高度设为 0 后就不显示线了, 不知道还有没有其它方法隐藏???
headerColor:"red",
headerLeft: ( //定义导航栏右侧的按钮
// <Text style={{width:1}}></Text>
<Btn_Qrcode/>
),
headerMode:'screen',
headerTitleStyle:{flex:1, alignItems: 'center',textAlign: 'center',justifyContent: 'center'},
// headerLeftContainerStyle: {paddingRight: 100},
headerRight:( //定义导航栏右侧的按钮
// <Text style={{width:1}}></Text>
<Btn_Remind/>
),
// headerTitle:
// <Button
// title="Go to Details"
// onPress={() => console.warn(DetailsScreen())}
// />
//<Btn_Qrcode/>
//title: 'Details',
};
render() {
return (
// <SafeAreaView style={styles.container}>
<View style={styles.container}>
{/* <View style={styles.home}> */}
<Mian/>
{/* <Login_index/> */}
{/* <Button
title="Go to Details"
onPress={() => this.props.navigation.push('Details')}
/> */}
{/* </View> */}
</View>
//</SafeAreaView>
);
}
}
const RootStack = createStackNavigator(
{
Login:{screen:Login_index},
Home:{ screen: HomeScreen } ,
QRvue:{ screen: QRvue},
Setup:{screen:Setup},
Details:{ screen: DetailsScreen},
},
{
initialRouteName: 'Login',
}
);
const Hello_Stack = createSwitchNavigator({
Welcome,
Welcome1,
App: RootStack
})
export default class App extends Component<Props> {
render() {
return (
// <Hello_Stack onNavigationStateChange={(prevState, currentState) => { console.log(currentState) }} />
// <Hello_Stack />
<SafeAreaView style={{flex: 1, backgroundColor: 'red'}} forceInset={{ bottom: 'never' ,top: 'never' }}>
<RootStack />
</SafeAreaView>
);
}
}
////消除多餘安全邊距 https://reactnavigation.org/docs/zh-Hans/handling-iphonex.html
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#F5FCFF',
},
home: {
flex: 16,
flexDirection: 'column',
},
logo: {
height: 120,
marginBottom: 16,
marginTop: 64,
padding: 10,
width: 135,
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#DDDDDD',
marginBottom: 5,
},
modules: {
margin: 20,
},
modulesHeader: {
fontSize: 16,
marginBottom: 8,
},
module: {
fontSize: 14,
marginTop: 4,
textAlign: 'center',
},
input: {
height: 40,
borderColor: 'gray',
borderWidth: 1,
margin: 10,
borderRadius: 5,
padding: 5,
},
navLeft: {
alignItems: 'center',
marginLeft: 10,
},
navRight: {
alignItems: 'center',
marginRight: 10,
},
navIcon: {
height: 20,
width: 20,
},
navText: {
fontSize: 10,
},
searchBox: {
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'center',
width: width * 0.7,
backgroundColor: '#ededed',
borderRadius: 5,
height: 30,
},
searchIcon: {
width: 16,
height: 16,
marginRight: 6,
},
searchContent: {
color: '#666',
fontSize: 14,
},
tabBarUnderline: {
backgroundColor: '#b4282d',
height: 2,
width: width / 8,
marginLeft: 6
}
});