我找到的包:https://www.npmjs.com/package/@react-native-masked-view/masked-view
CSS 示例一分钟:jsfiddle
我发现了这个问题,但他没有解决我的问题:React Native - 在图像上添加蒙版圆圈覆盖
从示例来看,结果是这样的,但我得到了相反的效果:
<MaskedView MaskElement={<View
style={{
// Transparent background because the mask is based on the alpha channel.
backgroundColor: transparent
flex: 1,
justifyContent: 'center',
alignItems: 'center',
}}
>
<View style={{
width: 30,
height: 30,
backgroundColor: 'black'
}}></View>
</View>} style={{
...styles.container,
backgroundColor: 'black'
}}>
</MaskedView>
我做错了什么以及如何解决?