import PropTypes from 'prop-types';
import React from 'react';
import { StyleSheet, Button, View } from 'react-native';

const Modal = ({ children, navigation, title }) => (
    <View style={styles.container}>
        <Button onPress={() => navigation.goBack()} title="Dismiss" />
        {children}
    </View>
);

Modal.propTypes = {
    children: PropTypes.node.isRequired,
    title: PropTypes.string,
};

Modal.defaultPorps = {
    title: null,
};

const styles = StyleSheet.create({
    container: {
        flex: 1,
        justifyContent: 'center',
        alignItems: 'center',
        backgroundColor: '#F5FCFF',
    },
    title: {
        fontSize: 20,
        textAlign: 'center',
        margin: 10,
    },
});

export default Modal;
