【发布时间】:2019-09-13 06:52:26
【问题描述】:
我有一些这样的文本段落:
<Text>
<Text>1111</Text>
<Text>2222</Text>
<Text style={{textAlign:"center"}}>
<Text>3333</Text>
</Text>
<Text>4444</Text>
<Text>5555</Text>
</Text>
显示如下:
11112222333344445555
虽然我希望它显示如下:
11112222
3333
44445555
其中3333为textAlign Center
我该怎么做?
我尝试设置 flexDirection,但没有成功。
数据结构有点复杂,比如
{
{ text : 'aaaa'}
{ text: [
{
text: [
{ text: 'bbbb' },
{ text: 'cccc', style:'bold' },
{
text : '3333',
style: 'center'
},
{ text: 'dddd'},
], style: 'bold'
},
{ text: 'eeee' }
]},
{ text: 'ffff', style:'i' },
{ text: 'gggg' }
}
由于View Component不能嵌套在Text Component中,所以无法将Text Wrapped 3333改为View。
【问题讨论】:
-
你的预期输出是什么?
-
3333 居中,而其他显示 textAlign:left
标签: react-native