-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
169 lines (159 loc) · 4.39 KB
/
App.js
File metadata and controls
169 lines (159 loc) · 4.39 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
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import { StyleSheet, Text, View ,SectionList,Button,Image} from 'react-native';
import {StackNavigator,TabNavigator,TabBarBottom} from 'react-navigation';
import ProfileScreen from './ProfileScreen'
import Page2 from "./Page2";
import Page3 from './Page3'
import Page4 from './Page4'
import Page5 from './Page5'
import LoginScreen from './Login'
class MainScreen extends React.Component{
static navigationOptions = {
title:'首页',
headerTitle:'首页啊',
headerStyle:{
backgroundColor:'#8ab7fc'
}
};
constructor(props){
super(props);
}
render() {
const {navigate} = this.props.navigation;
return (
<Button
title="Go to jane`s profile"
onPress={() =>
navigate('Profile', {name: 'Jane'})
}
/>
);
}
}
const MainScreenNavigator = TabNavigator({
Home:{
screen:MainScreen,
navigationOptions:({navigation})=>({
tabBarLabel:'首页',
headerBackTitle:null,
tabBarIcon: ({focused,tintColor}) => (
<Image
source={focused?require('./image/me1.png'):require('./image/me.png')}
style={{width:22,height:22,tintColor:tintColor}}
/>
),
})
},
Certificate:{
screen:Page2,
navigationOptions:{
tabBarLabel: '我的',
tabBarIcon:({tintColor})=>(
<Image
source={require('./image/circle.png')}
style={[{tintColor:tintColor},styles.icon]}
/>
),
}
},
page3:{
screen:Page3,
navigationOptions:{
tabBarLabel: '相册',
tabBarIcon:({tintColor})=>(
<Image
source={require('./image/tool.png')}
style={[{tintColor:tintColor},styles.icon]}
/>
),
}
},
page4:{
screen:Page4,
navigationOptions:{
tabBarLabel: '它的',
tabBarIcon:({tintColor})=>(
<Image
source={require('./image/hot.png')}
style={[{tintColor:tintColor},styles.icon]}
/>
),
}
},
page5:{
screen:Page5,
navigationOptions:{
tabBarLabel: '我的',
tabBarIcon:({tintColor})=>(
<Image
source={require('./image/circle.png')}
style={[{tintColor:tintColor},styles.icon]}
/>
),
}
},
}, {
tabBarComponent: TabBarBottom,
animationEnabled: false, // 切换页面时不显示动画
tabBarPosition: 'bottom', // 显示在底端,android 默认是显示在页面顶端的
swipeEnabled: false, // 禁止左右滑动
backBehavior: 'none', // 按 back 键是否跳转到第一个 Tab, none 为不跳转
tabBarOptions: {
activeTintColor: '#ff552e', // 文字和图片选中颜色
inactiveTintColor: '#333', // 文字和图片默认颜色
showIcon: true, // android 默认不显示 icon, 需要设置为 true 才会显示
indicatorStyle: {height: 0}, // android 中TabBar下面会显示一条线,高度设为 0 后就不显示线了
style: {
backgroundColor: '#fff', // TabBar 背景色
},
labelStyle: {
fontSize: 12, // 文字大小
},
}
});
const styles = StyleSheet.create({
container: {
flex: 1,
paddingTop: 22
},
sectionHeader:{
paddingTop:2,
paddingLeft:10,
paddingRight:10,
paddingBottom:2,
fontSize:12,
fontWeight:'bold',
backgroundColor:'rgba(247,247,247,1.0)',
},
item: {
padding: 10,
fontSize: 18,
height: 44,
},
icon:{
height: 24,
width: 24,
resizeMode: 'cover'
}
});
const SimpleApp = StackNavigator({
Main:{
screen:MainScreenNavigator,
title:'身'
},
Profile:{
screen:ProfileScreen,
title:'身'
},
Login:{
screen:LoginScreen,
}
},{
initialRouteName:'Main'
});
export default SimpleApp;