React native 如何将文本与行对齐?
我想实现以下目标。将文本放在两行之间。但到目前为止我还没有做到。 .React native 如何将文本与行对齐?,react-native,React Native,我想实现以下目标。将文本放在两行之间。但到目前为止我还没有做到。 . 到目前为止,我所取得的成就是这样的 我的代码是 <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}> <View style={{ width: Dimensions.get('screen').width / 2 - 20,
到目前为止,我所取得的成就是这样的 我的代码是
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
<View
style={{
width: Dimensions.get('screen').width / 2 - 20,
height: 3,
borderStyle: 'solid',
backgroundColor: 'black',
marginBottom: 15,
marginTop: 8,
left: 0,
}}
/>
<Text
style={[
{
fontSize: 18,
padding: 5,
marginBottom: 10,
color: 'black',
},
global.fontNormal,
]}>
{'or'}
</Text>
<View
style={{
width: Dimensions.get('screen').width / 2 - 20,
height: 3,
borderStyle: 'solid',
backgroundColor: 'black',
marginBottom: 15,
marginTop: 8,
right: 0,
}}
/>
</View>
{'or'}
有没有更好的方法来实现这一点?
建议我如何做到这一点?
谢谢,需要添加对齐项:'center' 与创建“弹性方向”行时一样,alignitems属性会垂直对齐内容,水平对齐内容
<View style={{ flexDirection: 'row', justifyContent: 'space-between', flex:1 , alignItems:'center'}}>
示例代码: