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, Image } from 'react-native';
import styles from './styles';
import { CloudCAProviderContext } from 'react-native-cloud-ca';
const DialogueConfirm = props => {
  const {
    children,
    title,
    confirmLabel,
    confirmOnPress,
    confirmDisable,
    closeLabel,
    closeOnPress,
    closeDisable,
    modalType,
    ...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: closeOnPress
  }, /*#__PURE__*/React.createElement(Image, {
    style: styles.closeImage,
    source: require('../../asset/icon/IC_CLOSE.png'),
    resizeMode: "stretch"
  })), !!(modalType !== null && modalType !== void 0 && modalType.length) && renderIcon(), /*#__PURE__*/React.createElement(Text, {
    style: styles.titleStyle
  }, title || 'Thông báo'), children, /*#__PURE__*/React.createElement(View, {
    style: styles.buttonWarp
  }, /*#__PURE__*/React.createElement(TouchableOpacity, {
    style: [styles.closeButton, {
      borderColor: themeColor
    }],
    onPress: closeOnPress,
    disabled: closeDisable
  }, /*#__PURE__*/React.createElement(Text, {
    style: [styles.closeText, {
      color: themeColor
    }]
  }, closeLabel || 'Đóng')), /*#__PURE__*/React.createElement(TouchableOpacity, {
    style: confirmDisable ? [styles.confirmButton, {
      backgroundColor: '#9099A0'
    }] : [styles.confirmButton, {
      backgroundColor: themeColor
    }],
    onPress: confirmOnPress,
    disabled: confirmDisable
  }, /*#__PURE__*/React.createElement(Text, {
    style: styles.confirmText
  }, confirmLabel || 'Xác nhận'))))));
};
export default DialogueConfirm;
//# sourceMappingURL=DialogueConfirm.js.map