<View>
<Text>
{/* Adding notification if exists otherwise ignore */}
{post.hasNotification ? post.notifications: ''}
</Text>
</View>
如何将 View 组件包裹在 post.notifications 周围?当我执行此操作时,出现错误:当前不支持使用文本嵌套视图。我需要用 View 组件包装它,以便我可以设置它的样式。
您不能在文本组件内使用视图组件。尝试这个,
<View>
{post.hasNotification ? <View><Text>post.notifications</Text></View> : ' '}
</View>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)