-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
188 lines (174 loc) · 4.57 KB
/
Copy pathApp.js
File metadata and controls
188 lines (174 loc) · 4.57 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
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
Platform,
StyleSheet,
Text,
View,
Image
} from 'react-native';
import {TabNavigator, StackNavigator} from 'react-navigation'
import HomeScreen from './app/screen/home/index';
import MineScreen from './app/screen/mine/index';
import ModalScreen from './app/screen/modal/index';
import UnlockScreen from './app/screen/unlock/index';
console.disableYellowBox = true;
const MainTab = TabNavigator(
{
Home: {
screen: HomeScreen,
navigationOptions: {
title: "首页",
tabBarLabel: '首页',
tabBarIcon: ({ tintColor }) => (
<Image
source={
require('./app/assets/images/home.png')
}
style={[styles.icon,{tintColor: tintColor}]}// {tintColor: tintColor} 选中的图片和文字颜色
/>
)
}
},
Unlock: {
screen: UnlockScreen,
navigationOptions: {
tabBarLabel: '解锁',
header:null,
tabBarIcon: ({ tintColor }) => (
<Image
source={
require('./app/assets/images/add.png')
}
style={[styles.icon,{tintColor: tintColor}]}// {tintColor: tintColor} 选中的图片和文字颜色
/>
),
headerTitleStyle: {
alignSelf:'center'
}
}
},
Mine: {
screen: MineScreen,
//以下参数也可放置在MinePage.js页面
navigationOptions: {
header:null,
tabBarLabel: '我的',
tabBarIcon: ({ tintColor }) => (
<Image
source={
require('./app/assets/images/mine.png')
}
style={[styles.icon,{tintColor: tintColor}]}// {tintColor: tintColor} 选中的图片和文字颜色
/>
),
headerTitleStyle: {
alignSelf:'center'
}
}
}
},
{
animationEnabled: false, // 切换页面时不显示动画
tabBarPosition: 'bottom', // 显示在底端,android 默认是显示在页面顶端的
swipeEnabled: true, // 禁止左右滑动
backBehavior: 'none', // 按 back 键是否跳转到第一个 Tab, none 为不跳转
tabBarOptions: {
activeTintColor: '#0F88EE', // 文字和图片选中颜色
inactiveTintColor: '#888', // 文字和图片默认颜色
showIcon: true, // android 默认不显示 icon, 需要设置为 true 才会显示
indicatorStyle: {height: 0}, // android 中TabBar下面会显示一条线,高度设为 0 后就不显示线了, 不知道还有没有其它方法隐藏???
style: {
backgroundColor: '#fff', // TabBar 背景色
height:50
},
labelStyle: {
fontSize: 11, // 文字大小,
marginTop: 0,
}
}
}
)
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
icon:{
width:20,
height:20
}
});
const RootStack = StackNavigator(
{
Main: {
screen: MainTab
},
MyModal: {
screen: ModalScreen
},
Mine: {
screen: MineScreen
}
},
{
mode: 'modal',
headerMode: 'none'
}
)
export default class App extends Component {
render() {
return <RootStack />
}
}
// export default TabNavigator({
// Home: { screen: HomeScreen },
// Settings: { screen: SettingsScreen },
// });
// const instructions = Platform.select({
// ios: 'Press Cmd+R to reload,\n' +
// 'Cmd+D or shake for dev menu',
// android: 'RN 之旅123,\n' +
// 'Shake or press menu button for dev menu wahah对的ssdddh',
// });
// type Props = {};
// export default class App extends Component<Props> {
// render() {
// return (
// <View style={styles.container}>
// <Text style={styles.welcome}>
// Welcome to React Native!
// </Text>
// <Text style={styles.instructions}>
// To get started, edit App.js
// </Text>
// <Text style={styles.instructions}>
// {instructions}
// </Text>
// </View>
// );
// }
// }
// const styles = StyleSheet.create({
// container: {
// flex: 1,
// justifyContent: 'center',
// alignItems: 'center',
// backgroundColor: '#F5FCFF',
// },
// welcome: {
// fontSize: 20,
// textAlign: 'center',
// margin: 10,
// },
// instructions: {
// textAlign: 'center',
// color: '#333333',
// marginBottom: 5,
// },
// });