EmptyView.js 1.5 KB
/**
 * Created by Cassie on 2018/05/14
 */
import React, {Component} from 'react';
import {
    ActivityIndicator,
    Animated,
    FlatList,
    Image,
    StatusBar,
    StyleSheet,
    Text,
    TextInput,
    TouchableOpacity,
    View
} from 'react-native';
import {height, width, zoomH, zoomW} from '../../utils/getSize';
import {conversionNumber, getHeaderHeight, getHeaderPadding, xnToast} from '../../utils/utils'
import AppService from "../../service/AppService";
import PropTypes from 'prop-types';

export default class EmptyView extends Component {

    //自定义属性
    static propTypes = {
        viewStyle: PropTypes.func, //整体style
        tipContent: PropTypes.string, //无内容的提示
    }

    constructor(props){
        super(props);
    };

    componentWillMount(){
    }


    render(){
        let propsStyle = !!this.props.viewStyle?this.props.viewStyle:styles.empty;
        let text = !!this.props.tipContent? this.props.tipContent:'暂无数据';
        return(
            <View style = {[styles.defaultStyle,propsStyle]}>
                <Image  style = {{height:100}}source={require('../../img/empty.png')} resizeMode= 'contain'></Image>
                <Text style = {{marginTop:10,color:'rgba(0,0,0,0.45)',backgroundColor:'transparent'}}>{text}</Text>
            </View>
        )
    }
  }


const styles = StyleSheet.create({
    defaultStyle: {
        width:'100%',
        alignItems:'center',
        position:'absolute',
        bottom:'50%'
    },

    empty:{

    }


});