【问题标题】:How to work with css position absolute and flex end in React native如何在 React Native 中使用 css position absolute 和 flex end
【发布时间】:2020-11-07 04:18:46
【问题描述】:

我需要在文本元素上创建一个视图。并且 View 中的元素应该从下到上排序

three
two
one
text element

如果顶部元素的数量增加,则不应下推文本元素。如何做到这一点?

我试过这样。通过onlayout事件获取文本元素x,y,width,height

<>
  <View>
    <Text>Text</Text>
  </View>
  <View
    style={{
      top: textEl?.top - 20,
      left: textE?.left,
      position: 'absolute',
      flexDirection:'column',
      justifyContent:'flex-end'
    }}>
    <View>
      <View>
        <Text>one</Text>
      </View>
      <View>
        <Text>two</Text>
      </View>
      <View>
        <Text>three</Text>
      </View>
    </View>
  </View>
</>;

【问题讨论】:

    标签: css react-native flexbox


    【解决方案1】:

    CSS : flex-wrap: wrap-revers 反应:flexWrap: 'wrap-revers'

    【讨论】:

    • 不工作@Dhruvi Makvana,无法从下到上堆叠视图
    猜你喜欢
    • 2021-04-01
    • 2023-01-25
    • 2013-01-23
    • 1970-01-01
    • 2018-09-21
    • 1970-01-01
    • 2021-08-05
    • 2015-06-15
    • 1970-01-01
    相关资源
    最近更新 更多