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

Class LinearGradient

index.windows.js:25–56  ·  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: any;
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.setNativeProps(props);
36 }
37
38 render() {
39 const {
40 children,
41 start,
42 end,
43 colors,
44 locations,
45 useAngle,
46 angleCenter,
47 angle,
48 style,
49 ...otherProps
50 } = this.props;
51 if ((colors && locations) && (colors.length !== locations.length)) {
52 console.warn('LinearGradient colors and locations props should be arrays of the same length');
53 }
54
55 return (
56 <View ref={(component) => { this.gradientRef = component; }} {...otherProps} style={style}>
57 <NativeLinearGradient
58 style={{ position: 'absolute', top: 0, left: 0, bottom: 0, right: 0 }}
59 colors={colors.map(processColor)}

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…