| 23 | }; |
| 24 | |
| 25 | export 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)} |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…