Skip to content

Commit dbe1d16

Browse files
committed
update
1 parent 4bbb998 commit dbe1d16

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

Diff for: index.js

+14-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ export default class Tabbar extends Component {
1010

1111
static propTypes = {
1212
...View.propTypes,
13-
style: View.propTypes.style
13+
style: View.propTypes.style,
14+
activeColor: React.PropTypes.string,
1415
}
1516
static Item = Item
1617
// 构造
@@ -19,7 +20,8 @@ export default class Tabbar extends Component {
1920
// 初始状态
2021
this.state = {
2122
content: this.props.children,
22-
contentActive: 0
23+
contentActive: 0,
24+
textActive: this.props.activeColor? this.props.activeColor: '#FE985B'
2325
}
2426
this.children = '2'
2527
}
@@ -50,11 +52,14 @@ export default class Tabbar extends Component {
5052
onPress={() => pressHandle(item.props.onPress, index)}
5153
underlayColor={'transparent'}
5254
>
53-
<View>
55+
<View style={styles.box}>
5456
<Image source={active? selected: item.props.icon}
5557
style={styles.icon}
5658
/>
57-
<Text style={styles.text}>我的</Text>
59+
<Text style={[styles.text, active&& {color: this.state.textActive}]}
60+
>
61+
{item.props.text}
62+
</Text>
5863
</View>
5964
</TouchableHighlight>
6065
)
@@ -92,6 +97,10 @@ const styles = StyleSheet.create({
9297
content: {
9398
flex: 1,
9499
},
100+
box: {
101+
flex: 1,
102+
alignItems: 'center',
103+
},
95104
footer: {
96105
width: width,
97106
flexDirection: 'row',
@@ -116,5 +125,5 @@ const styles = StyleSheet.create({
116125
color: '#9B9DB0',
117126
paddingTop: 3,
118127
textAlign: 'center'
119-
}
128+
},
120129
})

0 commit comments

Comments
 (0)