function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import React from 'react';
import { Modal, View, Text, TouchableOpacity } from 'react-native';
import { Image } from 'react-native';
import styles from './styles';
import { CloudCAProviderContext } from 'react-native-cloud-ca';
const Dialogue = props => {
  const {
    modalType,
    children,
    title,
    onClose,
    ...rest
  } = props;
  const cloudCAProviderContext = React.useContext(CloudCAProviderContext);
  const {
    themeColor
  } = cloudCAProviderContext;
  const icons = {
    ERROR: require('../../asset/icon/IC_ERROR.png'),
    WARNING: require('../../asset/icon/IC_WARNING.png'),
    SUCCESS: require('../../asset/icon/IC_SUCCESS.png')
  };
  const renderIcon = () => /*#__PURE__*/React.createElement(Image, {
    style: styles.iconStyle,
    source: icons[modalType || 'SUCCESS']
  });
  return /*#__PURE__*/React.createElement(Modal, _extends({
    animationType: "fade",
    visible: true,
    transparent: true
  }, rest), /*#__PURE__*/React.createElement(View, {
    style: styles.container
  }, /*#__PURE__*/React.createElement(View, {
    style: styles.contentContainer
  }, /*#__PURE__*/React.createElement(TouchableOpacity, {
    style: styles.closeStyle,
    onPress: onClose
  }, /*#__PURE__*/React.createElement(Image, {
    style: styles.closeImage,
    source: require('../../asset/icon/IC_CLOSE.png'),
    resizeMode: "stretch"
  })), renderIcon(), /*#__PURE__*/React.createElement(Text, {
    style: styles.titleStyle
  }, title || 'Thông báo'), children, /*#__PURE__*/React.createElement(TouchableOpacity, {
    style: [styles.closeButton, {
      backgroundColor: themeColor
    }],
    onPress: onClose
  }, /*#__PURE__*/React.createElement(Text, {
    style: styles.closeText
  }, "\u0110\xF3ng")))));
};
export default Dialogue;
//# sourceMappingURL=Dialogue.js.map