"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.IOImage = void 0;
var _react = require("react");
var _reactNative = require("react-native");
var _jsxRuntime = require("react/jsx-runtime");
const IOAspectRatioScaleMap = {
  "1:1": 1,
  "4:3": 4 / 3,
  "16:9": 16 / 9,
  "3:4": 3 / 4,
  "21:9": 21 / 9
};
const styles = _reactNative.StyleSheet.create({
  image: {
    width: "100%",
    height: undefined,
    resizeMode: "cover"
  }
});

/**
 * Image component that supports specific aspect ratio scales and sets alt text as mandatory.
 * @param imageProps
 * @param alt
 * @param aspectRatio
 */
const IOImage = ({
  imageProps,
  alt,
  aspectRatio = "1:1"
}) => {
  const aspectRatioStyle = (0, _react.useMemo)(() => ({
    aspectRatio: IOAspectRatioScaleMap[aspectRatio]
  }), [aspectRatio]);
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Image, {
    accessibilityIgnoresInvertColors: true,
    ...imageProps,
    style: [styles.image, aspectRatioStyle],
    alt: alt
  });
};
exports.IOImage = IOImage;
//# sourceMappingURL=Image.js.map