-
Notifications
You must be signed in to change notification settings - Fork 56
Expand file tree
/
Copy pathLinearGradientExamplePage.tsx
More file actions
50 lines (49 loc) · 1.53 KB
/
Copy pathLinearGradientExamplePage.tsx
File metadata and controls
50 lines (49 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
'use strict';
import * as React from 'react';
import {Text} from 'react-native';
import {Example} from '../components/Example';
import {Page} from '../components/Page';
import LinearGradient from 'react-native-linear-gradient';
export const LinearGradientExamplePage: React.FunctionComponent<{}> = () => {
const example1jsx = `<LinearGradient
start={{x: 0, y: 0}}
end={{x: 1, y: 0}}
colors={['#4c669f', '#3b5998', '#192f6a']}
style={{
paddingHorizontal: 24,
paddingVertical: 8,
borderRadius: 8,
alignSelf: 'flex-start'}}>
<Text>
Text within a gradient fill
</Text>
</LinearGradient>`;
return (
<Page
title="Linear Gradient"
description="Render a gradient color fill."
componentType="Community"
pageCodeUrl="https://github.com/microsoft/react-native-gallery/blob/main/src/examples/LinearGradientExamplePage.tsx"
documentation={[
{
label: 'Linear Gradient',
url: 'https://github.com/react-native-linear-gradient/react-native-linear-gradient',
},
]}>
<Example title="Horizontal Gradient" code={example1jsx}>
<LinearGradient
start={{x: 0, y: 0}}
end={{x: 1, y: 0}}
colors={['#4c669f', '#3b5998', '#192f6a']}
style={{
paddingHorizontal: 24,
paddingVertical: 8,
borderRadius: 8,
alignSelf: 'flex-start',
}}>
<Text style={{color: '#ffffff'}}>Text within a gradient fill</Text>
</LinearGradient>
</Example>
</Page>
);
};