import React from 'react'
import { Modal, ModalProps, KeyboardAvoidingView, Platform, StyleSheet, } from 'react-native'


type Props = ModalProps & {
    backdrop: React.Component,
}


export default class CustomModal extends React.Component<Props>
{
    render()
    {
        return (
            <Modal
                {...this.props}
                isBlurBackground
            >

                <KeyboardAvoidingView
                    style = { styles.container }
                    behavior = { Platform.OS == 'ios' ? 'padding' : null }
                >
                    { this.props.children }
                </KeyboardAvoidingView>
                {
                    this.props.backdrop
                    &&
                    this.props.backdrop
                }
            </Modal>
        )
    }

}




const styles = StyleSheet.create({
    container : {
        flex : 1,
    },
})
