react-native-svg 未检测到透明颜色

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

我面临着一个恼人的问题,使用react-native-svg来实现从灰色到透明颜色的径向渐变。

出于某种原因,我仍然可以在渐变的中心看到灰色色调,它应该是透明的,以便看到下面的图像,顶部没有任何颜色。

这是我正在使用的代码:

 <Svg
          height="700"
          width="1000"
          style={{ position: "absolute", left: -400, top: -350 }}
        >
          <Defs>
            <RadialGradient
              id="cardCircleGradient"
              cx="600"
              cy="600"
              rx="600"
              ry="600"
              fx="600"
              fy="600"
              gradientUnits="userSpaceOnUse"
            >
              <Stop offset="0" stopColor="#00000000" stopOpacity="0" /> <-HERE is where I cannot implement a transparent color
              <Stop
                offset="1"
                stopColor="rgba(14, 14, 14, 0.45)"
                stopOpacity="1"
              />
            </RadialGradient>
          </Defs>
          <Circle cx="600" cy="600" r="600" fill="url(#cardCircleGradient)" />
        </Svg>

有人遇到过类似的问题吗?

react-native svg radial-gradients
1个回答
0
投票

您可能需要添加“Just”,以便有一点点从无颜色到无颜色的渐变。

这终于对我有用了,谢谢https://stackoverflow.com/users/9641006/edoardo-trotta

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