https://www.jianshu.com/p/1412cf0ab3e7

    1. // 引用官网的例子
    2. import LinearGradient from 'react-native-linear-gradient';
    3. // Within your render function
    4. <LinearGradient colors={['#4c669f', '#3b5998', '#192f6a']} style={styles.linearGradient}>
    5. <Text style={styles.buttonText}>
    6. Sign in with Facebook
    7. </Text>
    8. </LinearGradient>
    9. // Later on in your styles..
    10. var styles = StyleSheet.create({
    11. linearGradient: {
    12. flex: 1,
    13. paddingLeft: 15,
    14. paddingRight: 15,
    15. borderRadius: 5
    16. },
    17. buttonText: {
    18. fontSize: 18,
    19. fontFamily: 'Gill Sans',
    20. textAlign: 'center',
    21. margin: 10,
    22. color: '#ffffff',
    23. backgroundColor: 'transparent',
    24. },
    25. });