import React from 'react';
import PropTypes from 'prop-types';
import {View, Modal, ActivityIndicator, Dimensions} from 'react-native';


export default class LoadingModal extends React.Component {
    render() {
        return (
            <Modal
                transparent={true}
                animationType="none"
                visible={this.props.isLoading}
                onRequestClose={() => {
                    console.log("Not implemented yet")
                }}>
                <View style={{
                    flex: 1,
                    height: Dimensions.get('window').height,
                    alignItems: 'center',
                    justifyContent: 'center',
                    backgroundColor: 'rgba(0,0,0,0.5)'
                }}>
                    <ActivityIndicator size='large' color={this.props.color}/>
                </View>
            </Modal>
        )
    }
}


LoadingModal.propTypes = {
    color: PropTypes.string.isRequired,
    isLoading: PropTypes.bool.isRequired
};

