MCPcopy Create free account
hub / github.com/react-native-linear-gradient/react-native-linear-gradient / LinearGradient

Class LinearGradient

index.ios.js:25–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23};
24
25export default class LinearGradient extends Component<Props> {
26 props: Props;
27 gradientRef = createRef<NativeLinearGradient>();
28
29 static defaultProps = {
30 start: { x: 0.5, y: 0.0 },
31 end: { x: 0.5, y: 1.0 },
32 };
33
34 setNativeProps(props: Props) {
35 this.gradientRef.current.setNativeProps(props);
36 }
37
38 render() {
39 const {
40 start,
41 end,
42 colors,
43 locations,
44 useAngle,
45 angleCenter,
46 angle,
47 ...otherProps
48 } = this.props;
49 if ((colors && locations) && (colors.length !== locations.length)) {
50 console.warn('LinearGradient colors and locations props should be arrays of the same length');
51 }
52
53 return (
54 <NativeLinearGradient
55 ref={this.gradientRef}
56 {...otherProps}
57 startPoint={convertPoint('start', start)}
58 endPoint={convertPoint('end', end)}
59 colors={colors.map(processColor)}
60 locations={locations ? locations.slice(0, colors.length) : null}
61 useAngle={useAngle}
62 angleCenter={convertPoint('angleCenter', angleCenter)}
63 angle={angle}
64 />
65 );
66 }
67}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…