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