React native React Native:如何将文本块放置在行的末尾
我想将文本块放在行的末尾,并在需要时换行,如下所示: 我尝试了很多,但都没有成功,以下是我的代码:React native React Native:如何将文本块放置在行的末尾,react-native,flexbox,React Native,Flexbox,我想将文本块放在行的末尾,并在需要时换行,如下所示: 我尝试了很多,但都没有成功,以下是我的代码: <View style={{ flexDirection: 'row', flexWrap: 'wrap', }}> <Text>React native text 1</Text> <Text>React native text 2</Text> <Text>React native text 3<
<View style={{
flexDirection: 'row',
flexWrap: 'wrap',
}}>
<Text>React native text 1</Text>
<Text>React native text 2</Text>
<Text>React native text 3</Text>
</View>
反应本机文本1
反应本机文本2
反应本机文本3
我的结果是:
请问我有什么办法可以做到这一点吗。谢谢您是否尝试在父文本组件中封装文本?像
<View style={{
//flexDirection: 'row', //no more needed
//flexWrap: 'wrap', //no more needed
}}>
<Text>
<Text>React native text 1</Text>
<Text>React native text 2</Text>
<Text>React native text 3</Text>
</Text>
</View>
反应本机文本1
反应本机文本2
反应本机文本3
您当前看到了什么?您是否尝试在视图上设置100%的宽度?谢谢,但我不想使用嵌套文本,因为onLayout
和和
不适用于嵌套文本是的!但是你可以在视图父级上使用它,它的坐标几乎和它的文本子级相同。这只是一个示例,实际上我的视图的子级包含许多文本元素,所以我想知道每个元素的位置