【问题标题】:React Native Web keeps removing `aspectRatio` property from style. How do I prevent thsi?React Native Web 不断从样式中删除“纵横比”属性。我该如何防止这种情况?
【发布时间】:2022-05-15 17:46:27
【问题描述】:

我试图让反应原生组件返回一个 View 和一个 aspect-ratio: 4.3 使用:

const component = () => <View style={{aspectRatio: 4 /3}} >{Content}</View>

我也试过了:

const component = () => <View style={{'aspect-ratio: 4 /3}} >{Content}</View>

在这两种情况下,CSS 属性都会被移除。有什么想法吗?

【问题讨论】:

    标签: reactjs stripe-payments react-native-web


    【解决方案1】:

    刚读到这个,但我认为应该是:

    const component = () => <View style={{aspectRatio: "4 /3"}} >{Content}</View>
    

    (4/3 必须用引号括起来)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-01-07
      • 1970-01-01
      • 1970-01-01
      • 2014-02-22
      • 2016-03-09
      • 2020-04-05
      • 1970-01-01
      相关资源
      最近更新 更多