File tree 1 file changed +14
-5
lines changed
1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,8 @@ export default class Tabbar extends Component {
10
10
11
11
static propTypes = {
12
12
...View . propTypes ,
13
- style : View . propTypes . style
13
+ style : View . propTypes . style ,
14
+ activeColor : React . PropTypes . string ,
14
15
}
15
16
static Item = Item
16
17
// 构造
@@ -19,7 +20,8 @@ export default class Tabbar extends Component {
19
20
// 初始状态
20
21
this . state = {
21
22
content : this . props . children ,
22
- contentActive : 0
23
+ contentActive : 0 ,
24
+ textActive : this . props . activeColor ? this . props . activeColor : '#FE985B'
23
25
}
24
26
this . children = '2'
25
27
}
@@ -50,11 +52,14 @@ export default class Tabbar extends Component {
50
52
onPress = { ( ) => pressHandle ( item . props . onPress , index ) }
51
53
underlayColor = { 'transparent' }
52
54
>
53
- < View >
55
+ < View style = { styles . box } >
54
56
< Image source = { active ? selected : item . props . icon }
55
57
style = { styles . icon }
56
58
/>
57
- < Text style = { styles . text } > 我的</ Text >
59
+ < Text style = { [ styles . text , active && { color : this . state . textActive } ] }
60
+ >
61
+ { item . props . text }
62
+ </ Text >
58
63
</ View >
59
64
</ TouchableHighlight >
60
65
)
@@ -92,6 +97,10 @@ const styles = StyleSheet.create({
92
97
content : {
93
98
flex : 1 ,
94
99
} ,
100
+ box : {
101
+ flex : 1 ,
102
+ alignItems : 'center' ,
103
+ } ,
95
104
footer : {
96
105
width : width ,
97
106
flexDirection : 'row' ,
@@ -116,5 +125,5 @@ const styles = StyleSheet.create({
116
125
color : '#9B9DB0' ,
117
126
paddingTop : 3 ,
118
127
textAlign : 'center'
119
- }
128
+ } ,
120
129
} )
You can’t perform that action at this time.
0 commit comments