我需要在应用屏幕上应用以下样式。
fobackground: linear-gradient(180deg, #00599B 0%, #002F52 100%);
使用react-native-linear-gradient,我尝试了以下代码,但不确定如何使用上面提供的0%和100%值。
<LinearGradient
colors={['#00599B', '#002F52']}
useAngle={true}
angle={180}
style={{
flex: 1,
}}>
<Text style={styles.buttonText}>Sign in with Facebook</Text>
</LinearGradient>
您可以使用rgba
颜色解决此问题:
我将您的十六进制转换为RGBA颜色:
<LinearGradient
colors={['rgba(0, 89, 155, 0)', 'rgba(0, 47, 82, 1)']}
useAngle={true}
angle={180}
style={{
flex: 1,
}}>
<Text style={styles.buttonText}>Sign in with Facebook</Text>
</LinearGradient>