1
在react-native iOS上,「react-native-linear-gradient」:「^ 2.0.0」。react-native-linear-gradient iOS上只顯示紅色邊框
在使用npm正確安裝此包後,使用'react-native link',我看到圍繞文本的紅色邊框,但沒有提供示例的任何漸變。
import LinearGradient from 'react-native-linear-gradient';
// Within your render function
<LinearGradient colors={['#4c669f', '#3b5998', '#192f6a']} style={styles.linearGradient}>
<Text style={styles.buttonText}>
Sign in with Facebook
</Text>
</LinearGradient>
// Later on in your styles..
var styles = StyleSheet.create({
linearGradient: {
flex: 1,
paddingLeft: 15,
paddingRight: 15,
borderRadius: 5
},
buttonText: {
fontSize: 18,
fontFamily: 'Gill Sans',
textAlign: 'center',
margin: 10,
color: '#ffffff',
backgroundColor: 'transparent',
},
});