如何使用masked-view来达到css例子中的效果?

问题描述 投票:0回答:1

我找到的包: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>

我做错了什么以及如何解决?

react-native
1个回答
0
投票

在这里我找到了答案:https://github.com/react-native-masked-view/masked-view/issues/147

通过这个包得到它:https://github.com/ibitcy/react-native-hole-view

玩得开心!

© www.soinside.com 2019 - 2024. All rights reserved.