import React from "react";
import RNModal from "react-native-modal";

import { View } from "../View";
import styles from "./styles";

type Props = {
  children: React.ReactNode;
  contentStyle?: {};
  onBackdropPress?: () => void;
  onDismiss?: () => void;
  visible: boolean;
  backdropColor?: string;
  backdropOpacity?: number;
  style?: {};
};

const Modal = ({
  children,
  visible,
  style: customStyle,
  contentStyle,
  ...props
}: Props) => (
  <RNModal isVisible={visible} style={[styles.modal, customStyle]} {...props}>
    <View style={[styles.content, contentStyle]}>{children}</View>
  </RNModal>
);

export default Modal;
