边框阴影 安卓可以用属性elevation,或者react-native-cardview 说到这两个属性就要说到层级关系,比如,给边框加了阴影以后,再想在上面通过position: ‘absolute’加一层遮罩,这个时候就发现遮罩无效 注意:
所以上面说的遮罩无效的问题,解决方法是在遮罩上也加上elevation
图片相关
文字渐变例子:
import { Svg, Rect, Defs, LinearGradient, Use, Stop, Text } from 'react-native-svg'
<Svg width="100" height="21" viewBox="0 0 100 21">
<Defs>
<LinearGradient
id="Gradient"
gradientUnits="userSpaceOnUse"
x1="0"
y1="0"
x2="100"
y2="0"
>
<Stop offset="0" stopColor={this.props.startColor} stopOpacity="1" />
<Stop offset="1" stopColor={this.props.endColor} stopOpacity="1" />
</LinearGradient>
<Text
id="Text"
x="50"
y="15"
fontFamily="Verdana"
fontSize="18"
textAnchor="middle"
>
{this.props.value}
</Text>
</Defs>
<Rect x="0" y="0" width="100" height="21" fill="#FFF" />
<Use href="#Text" fill="url(#Gradient)" />
</Svg>