1import PropTypes from 'prop-types';
2import React from 'react';
3import { ColorPropType, ViewPropTypes, processColor } from 'react-native';
4import NativeLinearGradient from './NativeLinearGradient';
5export default class LinearGradient extends React.Component {
6    render() {
7        let { colors, locations, start, end, ...props } = this.props;
8        if (locations && colors.length !== locations.length) {
9            console.warn('LinearGradient colors and locations props should be arrays of the same length');
10            locations = locations.slice(0, colors.length);
11        }
12        return (<NativeLinearGradient {...props} colors={colors.map(processColor)} locations={locations} startPoint={_normalizePoint(start)} endPoint={_normalizePoint(end)}/>);
13    }
14}
15LinearGradient.propTypes = {
16    ...ViewPropTypes,
17    colors: PropTypes.arrayOf(ColorPropType).isRequired,
18    locations: PropTypes.arrayOf(PropTypes.number),
19    start: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.number), PropTypes.object]),
20    end: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.number), PropTypes.object]),
21};
22function _normalizePoint(point) {
23    if (!point) {
24        return undefined;
25    }
26    if (Array.isArray(point) && point.length !== 2) {
27        console.warn('start and end props for LinearGradient must be of the format [x,y] or {x, y}');
28        return undefined;
29    }
30    return Array.isArray(point) ? point : [point.x, point.y];
31}
32//# sourceMappingURL=LinearGradient.js.map