ActivityIndicator.js
1.46 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
import React, {Component} from 'react'
import {
StyleSheet,
View,
Text,
Dimensions,
ActivityIndicatorIOS,
Platform,
ProgressBarAndroid,
} from 'react-native';
export default class ActivityIndicator extends Component {
renderFooter() {
if (this.props.hidden) {
return <View/>;
}else {
if (Platform.OS === 'android') {
return (
<View style={styles.footerContainer}>
<ProgressBarAndroid style={styles.footerIndicator}/>
<Text style = {styles.footerText}>{this.props.loadingText}</Text>
</View>
)
} else {
return (
<View style={styles.footerContainer}>
<ActivityIndicatorIOS style={styles.footerIndicator} size='small' animating={this.props.animating}/>
<Text style = {styles.footerText}>{this.props.loadingText}</Text>
</View>
)
}
}
}
render() {
return(
this.renderFooter()
);
}
}
const styles = StyleSheet.create({
footerContainer: {
flexDirection: 'row',
},
footerIndicator: {
marginTop: 15,
marginLeft: Dimensions.get('window').width/2-50,
marginRight: 10,
},
footerText: {
marginTop: 17,
textAlign: 'center',
color:'#b1b1b1',
},
});