EmptyView.js
1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/**
* 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:{
}
});