gpt4 book ai didi

reactjs - React-native:多色 TextView

转载 作者:行者123 更新时间:2023-12-03 13:12:55 26 4
gpt4 key购买 nike

我想渲染一行文本,其中一些单词以不同的颜色突出显示。

理想情况下,我会使用带有反应的跨度标签来完成此操作。

想知道如何使用 React-native 做同样的事情?

最佳答案

您可以通过使用嵌套文本组件来实现此目的

<Text style={{color: 'blue'}}>
I am blue
<Text style={{color: 'red'}}>
i am red
</Text>
and i am blue again
</Text>

这是一个link文档对其进行了更好的解释

关于reactjs - React-native:多色 TextView ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29372698/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com