react native android中GIF图像的圆角问题

Nit*_*ish 3 android gif react-native

我是 React Native 的新手,我在列表视图中显示了一个 GIF 图像列表,我尝试用普通图像执行此操作,并且它正在工作,但是对于 GIF 图像,它不起作用我现在不知道为什么。

我使用以下样式和代码使角变圆。

  <ListView contentContainerStyle={styles.list}
  showsHorizontalScrollIndicator={false}
  horizontal= { true }
  dataSource={this.state.dataSource}
   ref={ref => this.listView = ref}
  renderRow={(rowData) => {
    return (
      <TouchableOpacity style={styles.item} onPress={() => this.stickerSelected(rowData)}>
          <Image style={styles.image} source={this.props.images[rowData].src}/>
      </TouchableOpacity>
    )
  }}
  />



list: {
justifyContent: 'center',
flexDirection: 'column',
backgroundColor: '#FFFDEB',
flexWrap: 'wrap',
paddingLeft: 6,
paddingRight: 6


},
  item: {
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#EAD62F',
    borderRadius: 10,
    margin: 3,
    width: 75,
    height: 75,
  },
  image: {
    width: 75,
    height: 75,
    borderRadius: 10,
  }
Run Code Online (Sandbox Code Playgroud)

并尝试在图像和项目样式中添加以下属性以解决重叠问题,但角落仍为方形。

 overflow: 'hidden',
Run Code Online (Sandbox Code Playgroud)

Hea*_*ess 8

您需要设置overlayColor 样式。它在这里描述https://facebook.github.io/react-native/docs/image.html#style

image: { width: 75, height: 75, borderRadius: 10, overlayColor: 'white', }

  • 有没有其他办法?因为我的 gif 位于多色图案背景之上。所以我不能给它一个坚实的overlayColor。 (3认同)