世博线性渐变透明呈现黑色 [英] Expo Linear Gradient transparent is showing up blackish

查看:62
本文介绍了世博线性渐变透明呈现黑色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Expo Linear Gradients在我的React Native屏幕中实现从白底到白底的过渡: https://docs.expo.io/versions/latest/sdk/linear-gradient.html

I'm trying to get a bottom to top white to transparent-white transition in my React Native screen using Expo Linear Gradients: https://docs.expo.io/versions/latest/sdk/linear-gradient.html

我复制了第二个示例并将其翻转,并使其变为白色而不是黑色.但是现在白色应该淡入的透明"颜色比白色要暗,请参见下文:

I copied the second example and flipped it around, and made it white instead of black. But now the "transparent" the white is supposed to fade in to is darker that the white is, see below:

透明实际上是透明的,所以很好,但是有没有办法给它白色的色调?

The transparent actually is see through so that's good but is there a way to give it a white hue?

此处的代码:

     <LinearGradient
         colors={[ 'transparent', 'rgba(255,255,255,0.8)']}
         style={{
           position: 'absolute',
           left: 0,
           right: 0,
           bottom: 0,
           height: 200,
         }}
       />

推荐答案

这是因为transparent等于rgba(0,0,0,0)

尝试使用rgba(255,255,255,0)而不是透明的方法来实现从白色到白色的过渡

Try using rgba(255,255,255,0) instead of transparent to get a white to white transition

w3规范将透明定义为transparent black,可以在此处

The w3 spec defines transparent as transparent black as can be read here

这篇关于世博线性渐变透明呈现黑色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆