【问题标题】:Background Color and Border Radius property not working together in React Native - Android背景颜色和边框半径属性在 React Native 中无法协同工作 - Android
【发布时间】:2020-02-15 03:33:36
【问题描述】:

它发生在我的 react native 项目从 0.59.9 更新到 0.61.1 之后。我有TouchableOpacity,带有borderRadius 和backgroundColor 样式当我查看iOS 时它看起来不错,但在Android 中,视图中没有背景颜色。它只是透明的。以前没有这样的问题。

<TouchableOpacity style={{backgroundColor: 'black' ,justifyContent: 'center', flex:1, borderRadius: scale(22)}} />         

【问题讨论】:

    标签: reactjs react-native react-native-android styling


    【解决方案1】:

    scale() 是返回值的自定义函数吗?我已经尝试过这种方式并且它有效;

    <TouchableOpacity style={{backgroundColor: 'black' ,justifyContent: 'center', flex:1, borderRadius: 22}}>
      <Text>Sign In</Text>
    </TouchableOpacity> 
    

    或者尝试清除缓存:npm clear cache --force

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-09-19
      • 2012-10-09
      • 2011-09-12
      • 2013-10-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多