【发布时间】:2018-02-15 09:54:28
【问题描述】:
如果我有未读消息,我将如何使用 if 语句返回不同的图标? 或者我不会使用 if 语句?也许在某事上设置状态?不知道这里的最佳路线是什么。
static navigationOptions = {
tabBarIcon: ({ focused }) => (
focused
? <Icon name="ios-mail"
style={styles.activeIconRight}
/>
: <Icon name="ios-mail"
style={styles.inActiveIconRight}
/>
),
}
updateUnread = () => {
if (this.state.unread == true) {
this.props.navigation.setParams({otherParam: 'NEW'})
} else {
this.props.navigation.setParams({otherParam: ' '})
}
}
【问题讨论】:
标签: react-native react-navigation