@@ -25,6 +25,28 @@ React-Native text gradient component for iOS & Android.
25
25
- Android - WIP, currently only basic 'wrapper'-like behavior without nesting is supported;
26
26
- React-Native - supported version >0.50, except of 0.53.0.
27
27
28
+
29
+ ## Example
30
+
31
+ ``` javascript
32
+ import { LinearTextGradient } from ' react-native-text-gradient' ;
33
+
34
+ < LinearTextGradient
35
+ style= {{ fontWeight: ' bold' , fontSize: 72 }}
36
+ locations= {[0 , 1 ]}
37
+ colors= {[' red' , ' blue' ]}
38
+ start= {{ x: 0 , y: 0 }}
39
+ end= {{ x: 1 , y: 0 }}
40
+ >
41
+ THIS IS TEXT GRADIENT
42
+ < / LinearTextGradient>
43
+ ```
44
+
45
+ iOS | Android
46
+ :---------------------------------------------:|:---------------------------------------------:
47
+ <img src =" img/ios.png " align =" left " height =" 275 " > | <img src =" img/android.jpg " align =" right " height =" 275 " >
48
+
49
+
28
50
## Usage
29
51
30
52
### LinearTextGradient
@@ -45,28 +67,21 @@ An optional array of numbers defining the location of each gradient color stop,
45
67
#### useViewFrame
46
68
Optional. If true gradient will be calculated for text view background frame rather than text frame.
47
69
48
- <img src =" img/useViewFrame.png " width =" 300 " >
49
-
50
-
51
- ## Example
52
-
53
70
``` javascript
54
- import { LinearTextGradient } from ' react-native-text-gradient' ;
55
-
56
71
< LinearTextGradient
57
- style= {{ fontWeight: ' bold' , fontSize: 72 }}
58
- locations= {[0 , 1 ]}
59
- colors= {[' red' , ' blue' ]}
72
+ numberOfLines= {1 }
73
+ useViewFrame= {true }
74
+ locations= {[0.5 , 0.95 ]}
75
+ // note colors like '#FF000000' are used for seamless transition to transparent
76
+ colors= {[' #FF0000' , ' #FF000000' ]}
60
77
start= {{ x: 0 , y: 0 }}
61
78
end= {{ x: 1 , y: 0 }}
62
79
>
63
- THIS IS TEXT GRADIENT
80
+ %%%%%%%%%%%%%%%%%%%%%%
64
81
< / LinearTextGradient>
65
82
```
66
83
67
- iOS | Android
68
- :---------------------------------------------:|:---------------------------------------------:
69
- <img src =" img/ios.png " align =" left " height =" 275 " > | <img src =" img/android.jpg " align =" right " height =" 275 " >
84
+ <img src =" img/useViewFrame.png " width =" 300 " >
70
85
71
86
72
87
## Caveats
0 commit comments