import React, { Component } from 'react'
import { StyleSheet, View, Text, Image, ActivityIndicator } from 'react-native'
import { height, width } from './base';
export interface Props {
    text?: any
}

export interface State {
    show?: boolean
}

export default class LoadingToast extends React.Component<Props, State> {
    constructor(props) {
        super(props);

    }
    componentDidMount() {

    }
    public readonly state: Readonly<State> = {
        show: false
    }

    show = () => {
        console.log("哈哈哈")
        this.setState({ show: true })
    };
    hide = () => {
        this.setState({ show: false })
    };

    render() {
        let { show } = this.state;
        let { text } = this.props
        return (


            <>
                {
                    show ? <View style={styles.LoadingPage}>
                        <View style={{
                            width: 100,
                            height: 100,
                            backgroundColor: "rgba(0,0,0,0.6)",
                            opacity: 1,
                            justifyContent: "center",
                            alignItems: "center",
                            borderRadius: 7
                        }}>
                            <ActivityIndicator size="large" color="#FFF" />
                            <Text style={{ marginLeft: 10, color: "#FFF", marginTop: 10 }}>{text ? text : "正在加载"}...</Text>
                        </View></View> : null
                }
            </>




        );

    }
}
const styles = StyleSheet.create({
    LoadingPage: {
        position: "absolute",
        left: 0,
        top: 0,
        backgroundColor: "rgba(0,0,0,0)",
        width: width,
        height: height,
        justifyContent: "center",
        alignItems: "center",
    },


})