Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
React native 如何将文本与行对齐?_React Native - Fatal编程技术网

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'}}>

示例代码: