【问题标题】:How to make 2 <Text> inline in React Native如何在 React Native 中使 2 个 <Text> 内联
【发布时间】:2022-01-06 06:56:04
【问题描述】:

我想在一行中制作 2 个,一个 flex-end 和一个 flex-start,但是在将 flex-endflex-start 分别应用于这两个之后,我无法使其内联。有人知道怎么做吗?

<View style={{flexDirection: 'row'}}>
   <Text style={{alignSelf: 'flex-start'}}>Line 1</Text>
   <Text style={{alignSelf: 'flex-start'}}>Line 2</Text>
</View>

【问题讨论】:

    标签: css react-native


    【解决方案1】:

    只需使用justifyContent:'space-between'即可,无需使用Text中的任何内容

    <View style={{flexDirection: 'row', justifyContent:'space-between'}}>
       <Text>Line 1</Text>
       <Text>Line 2</Text>
    </View>
    

    【讨论】:

      猜你喜欢
      • 2018-08-18
      • 1970-01-01
      • 2020-02-15
      • 1970-01-01
      • 2020-09-08
      • 2021-09-29
      • 1970-01-01
      • 2018-07-04
      • 1970-01-01
      相关资源
      最近更新 更多