"use strict";

import { useMemo } from "react";
import { Image, StyleSheet } from "react-native";
import { jsx as _jsx } from "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 = 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
 */
export const IOImage = ({
  imageProps,
  alt,
  aspectRatio = "1:1"
}) => {
  const aspectRatioStyle = useMemo(() => ({
    aspectRatio: IOAspectRatioScaleMap[aspectRatio]
  }), [aspectRatio]);
  return /*#__PURE__*/_jsx(Image, {
    accessibilityIgnoresInvertColors: true,
    ...imageProps,
    style: [styles.image, aspectRatioStyle],
    alt: alt
  });
};
//# sourceMappingURL=Image.js.map