【问题标题】:Transparent border broken on android react nativeandroid react native上的透明边框损坏
【发布时间】:2019-08-22 11:04:02
【问题描述】:

尝试在反应原生的每个单元格周围制作透明边框。它在 iOS 上完美运行,但在 android 上不起作用,而是在单元格周围产生灰色/阴影状边框。当我将边框设置为 0 时,它可以工作,但我需要将边框设置为 2 以解决不同的格式问题。

任何帮助表示赞赏!

尝试边框颜色:透明,#0000000

const VerticalContainer = styled(Container)`
  justify-content: center;
  backgroundColor: white
  borderRadius: 8
  margin: 6px 0px
  padding: 15px 20px 15px 20px
  elevation: 1
  min-height: 70
  shadow-color: gray
  shadow-offset: 2px 2px
  shadow-opacity: 0.2
  shadow-radius: 4px
  border-width: 2
  border-color: transparent
`

iOS transparent border that works

android with border not working as not transparent

【问题讨论】:

    标签: android react-native border transparent border-color


    【解决方案1】:

    您应该在 Android 上检查 shadowColor、shadowOpacity 和海拔:

     someStyle: {
            shadowColor: 'rgba(0,0,0,0)',
            shadowOffset: {
                width: 0,
                height: 0,
            },
            shadowOpacity: 0,
            elevation: Platform.OS === 'ios' ? null : 0,
        },
    
    

    【讨论】:

      猜你喜欢
      • 2020-01-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多