-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathApp.js
166 lines (150 loc) · 3.42 KB
/
App.js
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
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component,PropTypes } from 'react';
// import PropTypes from 'prop-types';
// import Index from './pages/Index'
import detail from './pages/listDetail'
import list from './pages/list'
import index from './pages/Index'
// import CustomerComponents, {Navigator} from 'react-native-deprecated-custom-components'
import {
Platform,
StyleSheet,
Text,
View,
Image,
Button,
NavigatorIOS
} from 'react-native';
import {StackNavigator} from "react-navigation";
const instructions = Platform.select({
ios: 'Press Cmd+R to reload,\n' +
'Cmd+D or shake for dev menu',
android: 'Double tap R on your keyboard to reload,\n' +
'Shake or press menu button for dev menu',
});
const RouteConfigs = {
Home:{
screen:list,
navigationOptions: ({navigation}) => ({
title: '首页',
}),
},
detail:{
screen:detail,
navigationOptions: ({navigation}) => ({
// title: '详情',
}),
},
index:{
screen:index,
navigationOptions: ({navigation}) => ({
title: '页面',
}),
}
}
const StackNavigatorConfig = {
initialRouteName:'Home',
initialRouteParams: {initPara: '初始页面参数'},
// navigationOptions: {
// title: '标题',
// // headerTitleStyle: {fontSize: 18, color: '#666666'},
// headerStyle: {height: 48, backgroundColor: '#fff'},
// // headerRight:(
// // <Button title="布局"
// // onPress={()=>{
// // navigation('index')
// // }}
// // ></Button>
// // )
// },
cardStyle: {backgroundColor: "#ffffff"},
}
const Navigator = StackNavigator(RouteConfigs, StackNavigatorConfig);
export default class App extends Component<{}> {
/**
* 使用动态页面加载
* @param route 路由
* @param navigator 导航器
* @returns {XML} 页面
*/
// renderScene(route, navigator) {
// let Component = route.component
// return <Component{...route.params} navigator={navigator} />;
// }
/**
* 配置场景动画
* @param route 路由
* @param routeStack 路由栈
* @returns {*} 动画
*/
// configureScene(route) {
// if (route.type == 'Modal') {
// return Navigator.SceneConfigs.FloatFromBottom;
// }
// return Navigator.SceneConfigs.PushFromRight;
// }
render() {
// if (Platform.OS === 'android') {
return (
<Navigator></Navigator>
)
// }else{
// return (
// <NavigatorIOS style={styles.flex_1} initialRoute={{title:'首页',component:list}}></NavigatorIOS>
// )
// }
}
}
const styles = StyleSheet.create({
row:{
flexDirection:'row',
},
padding_20_top:{
paddingTop:20
},
part_1_left:{
flex:1,
borderColor:'#DCD7CD',
borderRightWidth:0.5,
borderBottomWidth:1,
},
part_2_right:{
flex:2,
borderColor:'#DCD7CD',
borderRightWidth:0.5,
borderBottomWidth:1,
},
flex_1:{
flex:1,
},
hanbao:{
width:55,
height:55
},
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
// margin: 10,
marginTop:10,
paddingBottom:20
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
pic:{
width:100,
height:100,
}
});