【发布时间】:2017-08-28 08:41:40
【问题描述】:
我需要在 touchableOpacity 中显示一个图标,仅当作为参数传递的值使用函数返回为 True 时。
请指导我,因为它显示了 renderIcon() 函数的一些错误。
const CardTitle = ({ titleText, EditButton = false }) => {
if (EditButton === true) {
this.state = {
status: true,
}
}
renderIcon() {
if (EditButton) {
return
(<Text style={styles.IconStyle}>{"\ue90b"} </Text>);
}
}
return (
<View style={styles.container}>
<Text style={styles.HeadingStyle}>
{titleText}
</Text>
<TouchableOpacity>
{this.renderIcon()}
</TouchableOpacity>
</View>
);
};
也可能是语法错误..
【问题讨论】:
标签: android reactjs react-native react-redux