import React from 'react';
import { View, Text, ActivityIndicator } from 'react-native';
import styles from './Styles';
import { Colors } from './../../theme';


export interface Props {
  show?: boolean;
  transparent?: boolean;
}

class Loader extends React.PureComponent<Props> {
  render() {
    const { show, transparent } = this.props;
    if (!show) return null;

    return (
      <View style={[styles.container, transparent && styles.transparent]}>
        <ActivityIndicator size={'large'} color={Colors.black} />
        <Text style={styles.loaderText}>loading</Text>
      </View>
    );
  }
}

Loader.defaultProps = {
  show: false,
  transparent: false
};

export default Loader;
