【发布时间】:2019-12-08 16:26:36
【问题描述】:
<View>
<Text>
{/* Adding notification if exists otherwise ignore */}
{post.hasNotification ? post.notifications: ''}
</Text>
</View>
如何将 View 组件包裹在 post.notifications 周围?当我这样做时,我得到一个错误,目前不支持带有文本的嵌套视图。我需要用一个 View 组件包装它,以便我可以设置它的样式。
【问题讨论】:
-
你能分享你的代码吗?
-
我在上面分享了,或者我的问题解释得不好?
-
{post.hasNotification ?
post.notifications : ' ' } 是我想要的代码,视图组件包装了 post.notifications -
你不能在
组件中使用
标签: reactjs react-native text view native