0
我试图设置onPress来调用action
来分派图标,具体取决于Redux中的状态。根据状态设置图标onPress
<MaterialIcons
name="arrow-upward" size={30} style={mystyles1.myIcon}
onPress = this.props.style.name === 'styleNormal' ?
{() => this.props.changeStyleNew('styleNew')} :
{()=>this.props.changeStyleNormal('styleNormal')}
>
</MaterialIcons>
因此,如果this.props.style.name === 'styleNormal'
第一功能(changeStyleNew
)获得通过,如果不是第二个(changeStyleNormal
)。我无法做到这一点。我收到错误:
TransformError C:/.../ExtComp02.js:
JSX value should be either an expression or a quoted JSX text (94:19)
我该如何做到这一点?非常感谢。