LoadMoreIndicator.js
1.24 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
'use strict';
import React, {Component} from 'react'
import {
StyleSheet,
View,
Text,
Dimensions,
ActivityIndicator,
Platform,
} from 'react-native';
export default class LoadMoreIndicator extends Component {
static propTypes = {
isVisible: React.PropTypes.bool.isRequired,
animating: React.PropTypes.bool,
text: React.PropTypes.string,
};
static defaultProps = {
text: '加载中...',
};
render() {
if (this.props.isVisible) {
return (
<View style={styles.container}>
{this.props.animating ?
<ActivityIndicator style={styles.indicator} size={'small'} /> :
null}
<Text style={styles.text}>{this.props.text}</Text>
</View>
);
} else {
return null;
}
}
}
const styles = StyleSheet.create({
container: {
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
width: Dimensions.get('window').width,
height: 44,
},
indicator: {
},
text: {
marginLeft: 10,
textAlign: 'center',
color:'#b1b1b1',
},
});