import React, { PureComponent } from "react";
import { View, Modal, TouchableWithoutFeedback, KeyboardAvoidingView, Platform } from "react-native";
import { withSafeAreaInsets } from "react-native-safe-area-context";
class MiddlePopup extends PureComponent {
  render() {
    var _this$props$insets;
    const bottom = Platform.OS === "android" ? ((_this$props$insets = this.props.insets) === null || _this$props$insets === void 0 ? void 0 : _this$props$insets.bottom) ?? 0 : 0;
    return /*#__PURE__*/React.createElement(Modal, {
      visible: this.props.visible,
      transparent: true,
      animationType: "fade",
      onRequestClose: this.props.onClose
    }, /*#__PURE__*/React.createElement(KeyboardAvoidingView, {
      behavior: this.props.keyboardAvoid && Platform.OS === "ios" && "padding",
      style: styles.popup
    }, /*#__PURE__*/React.createElement(TouchableWithoutFeedback, {
      onPress: this.props.onClose
    }, /*#__PURE__*/React.createElement(View, {
      style: styles.popupOverlay
    })), /*#__PURE__*/React.createElement(View, {
      style: [styles.popupContent, this.props.style, bottom > 0 && {
        paddingBottom: bottom
      }]
    }, this.props.children)));
  }
}
const styles = {
  popup: {
    flex: 1,
    justifyContent: "center",
    alignItems: "center"
  },
  popupOverlay: {
    position: "absolute",
    backgroundColor: "rgba(19, 19, 26, .25)",
    top: 0,
    left: 0,
    right: 0,
    bottom: 0
  },
  popupContent: {
    borderRadius: 12,
    backgroundColor: "#fff",
    alignItems: "center"
  }
};
const MiddlePopupWithInsets = withSafeAreaInsets(MiddlePopup);
export { MiddlePopupWithInsets as MiddlePopup };
//# sourceMappingURL=MiddlePopup.js.map