我正在尝试为有关图像应用渐变颜色,但是没有生效。我尝试在tintColor
处于样式内和道具时进行集成。有人可以帮忙吗,谢谢。
import LinearGradient from 'react-native-linear-gradient'
const grad = <LinearGradient colors={['#FFFF', '#3b5998', '#192f6a']}
style={{position:'absolute'}}></LinearGradient>
class DocSelection extends React.Component{
render(){
return(
<View style={styles.container}>
<TouchableOpacity
activeOpacity={0.7}
onPress={() => {
navigation.navigate("Account")
}}
style={ {position: 'absolute',
width: 45,
height: 45,
alignItems: 'center',
justifyContent: 'center',
left: wp('5%'),
top: hp('43%'),
backgroundColor:'white',
borderRadius: 45/2}}>
<Image
source={require("../Icons/account.png")}
style={{ resizeMode: 'contain',
width: 27.5,
height: 27.5,
}}
tintColor= {grad}
/>
</TouchableOpacity>
</View>
)}