Skip to content

Commit 98d625b

Browse files
committed
Merge branch 'master' of github.com:iyegoroff/react-native-text-gradient
2 parents 40ffa63 + 1c82f4f commit 98d625b

File tree

1 file changed

+29
-14
lines changed

1 file changed

+29
-14
lines changed

README.md

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,28 @@ React-Native text gradient component for iOS & Android.
2525
- Android - WIP, currently only basic 'wrapper'-like behavior without nesting is supported;
2626
- React-Native - supported version >0.50, except of 0.53.0.
2727

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+
2850
## Usage
2951

3052
### LinearTextGradient
@@ -45,28 +67,21 @@ An optional array of numbers defining the location of each gradient color stop,
4567
#### useViewFrame
4668
Optional. If true gradient will be calculated for text view background frame rather than text frame.
4769

48-
<img src="img/useViewFrame.png" width="300">
49-
50-
51-
## Example
52-
5370
```javascript
54-
import { LinearTextGradient } from 'react-native-text-gradient';
55-
5671
<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']}
6077
start={{ x: 0, y: 0 }}
6178
end={{ x: 1, y: 0 }}
6279
>
63-
THIS IS TEXT GRADIENT
80+
%%%%%%%%%%%%%%%%%%%%%%
6481
</LinearTextGradient>
6582
```
6683

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">
7085

7186

7287
## Caveats

0 commit comments

Comments
 (0)