import React from 'react';
import LinearGradient from 'react-native-linear-gradient';
import Color from 'colorjs.io';
const Gradient = ({
  children,
  colors,
  transparencyPosition = 'top',
  height,
  style,
  testID,
  pointerEvents
}) => {
  let calculatedColors = colors;
  if (colors.length === 1) {
    const [raw] = colors;
    const transparent = new Color(raw).to('srgb');
    transparent.alpha = 0;
    calculatedColors = transparencyPosition === 'top' ? [transparent.toString(), raw, raw] : [raw, raw, transparent.toString()];
  }
  const _style = [];
  if (style) {
    _style.push(style);
  }
  if (height) {
    _style.push({
      height
    });
  }
  return /*#__PURE__*/React.createElement(LinearGradient, {
    colors: calculatedColors,
    style: _style,
    pointerEvents: pointerEvents,
    testID: testID
  }, children) || null;
};
export default Gradient;
//# sourceMappingURL=index.native.js.map