forked from software-mansion/react-native-svg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLinearGradient.tsx
45 lines (41 loc) · 1.07 KB
/
LinearGradient.tsx
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
import React, { ReactElement } from 'react';
import { requireNativeComponent } from 'react-native';
import extractGradient from '../lib/extract/extractGradient';
import { NumberProp, TransformProps } from '../lib/extract/types';
import Shape from './Shape';
export default class LinearGradient extends Shape<{
id?: string;
x1?: NumberProp;
y1?: NumberProp;
x2?: NumberProp;
y2?: NumberProp;
children?: ReactElement[];
transform?: number[] | string | TransformProps;
gradientTransform?: number[] | string | TransformProps;
gradientUnits?: 'objectBoundingBox' | 'userSpaceOnUse';
}> {
static displayName = 'LinearGradient';
static defaultProps = {
x1: '0%',
y1: '0%',
x2: '100%',
y2: '0%',
};
render() {
const { props } = this;
const { x1, y1, x2, y2 } = props;
return (
<RNSVGLinearGradient
ref={this.refMethod}
x1={x1}
y1={y1}
x2={x2}
y2={y2}
{...extractGradient(props, this)}
/>
);
}
}
export const RNSVGLinearGradient = requireNativeComponent(
'RNSVGLinearGradient',
);