"use strict";

import { useRef } from 'react';
import { CloseButton, GroupContainer, ModalBackground, ModalContainer, ModalDescription, ModalTitle } from '../styledModalComponents';
import Button from '../../styled/Button';
import { Modal, Text } from 'react-native';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
export const ModalWrapper = ({
  iconTitle: IconTitle,
  title,
  description,
  buttonText,
  backgroundColorButton,
  isTextarea,
  textarea,
  setTextarea,
  handleCloseModal,
  handleClick
}) => {
  const textareaRef = useRef(null);

  // const handleInput = () => {
  //   const textarea = textareaRef.current;
  //   if (textarea) {
  //     textarea.style.height = "auto";
  //     textarea.style.height = `${textarea.scrollHeight}px`;
  //   }
  // };

  return /*#__PURE__*/_jsx(Modal, {
    transparent: true,
    animationType: "fade",
    visible: true,
    onRequestClose: handleCloseModal,
    children: /*#__PURE__*/_jsx(ModalBackground, {
      children: /*#__PURE__*/_jsxs(ModalContainer, {
        style: {
          maxWidth: 640
        },
        children: [/*#__PURE__*/_jsx(CloseButton, {
          onPress: handleCloseModal,
          children: /*#__PURE__*/_jsx(Text, {
            style: {
              fontSize: 24
            },
            children: "\xD7"
          })
        }), IconTitle ? /*#__PURE__*/_jsx(IconTitle, {}) : /*#__PURE__*/_jsx(ModalTitle, {
          children: title
        }), description && /*#__PURE__*/_jsx(ModalDescription, {
          children: description
        }), isTextarea && /*#__PURE__*/_jsx(GroupContainer, {
          style: {
            flexDirection: 'column',
            position: 'relative'
          }
        }), !buttonText && /*#__PURE__*/_jsx(GroupContainer, {}), /*#__PURE__*/_jsxs(GroupContainer, {
          children: [/*#__PURE__*/_jsx(Button, {
            onPress: handleCloseModal,
            text: 'Cancel',
            style: {
              width: '100%'
            },
            unstyled: true,
            variant: "outlined"
          }), buttonText && /*#__PURE__*/_jsx(Button, {
            onPress: handleClick,
            text: buttonText,
            style: {
              width: '100%',
              backgroundColor: backgroundColorButton
            },
            unstyled: true,
            variant: "filled"
          })]
        })]
      })
    })
  });
};
//# sourceMappingURL=ModalWrapper.js.map