"use strict";

exports.__esModule = true;
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _reactNativeLinearGradient = _interopRequireDefault(require("react-native-linear-gradient"));
var _colorjs = _interopRequireDefault(require("colorjs.io"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const Gradient = ({
  children,
  colors,
  transparencyPosition = 'top',
  height,
  style,
  testID,
  pointerEvents
}) => {
  let calculatedColors = colors;
  if (colors.length === 1) {
    const [raw] = colors;
    const transparent = new _colorjs.default(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.default.createElement(_reactNativeLinearGradient.default, {
    colors: calculatedColors,
    style: _style,
    pointerEvents: pointerEvents,
    testID: testID
  }, children) || null;
};
var _default = exports.default = Gradient;
//# sourceMappingURL=index.native.js.map