Dan*_*cer 0 reactjs react-native
<View >
<Text style={HomeStyles.homeSegmentText}>
{currentUser.badgeId}
<Text style={!(this.props.expiryAlert) && {display:'none'}} )>
<BlinkMe days={getDays()} />
</Text>
</Text>
</View>
Run Code Online (Sandbox Code Playgroud)
在上面的示例中,我希望仅在expiryAlert为true时才显示BlinkMe组件-但无论嵌套嵌套文本组件如何,display:none都不会被忽略-是否有人有解决办法?
Display property isn't supported for the Text component, you should have a look at it style's props.
As a workaround you can do the following:
<View>
<Text style={HomeStyles.homeSegmentText}>
{currentUser.badgeId}
{!(this.props.expiryAlert) &&
<Text>
<BlinkMe days={getDays()} />
</Text>
}
</Text>
</View>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
65 次 |
| 最近记录: |