-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCustomActivityIndicator2.js
58 lines (42 loc) · 1.39 KB
/
CustomActivityIndicator2.js
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
/**
* Created by mosesesan on 6/9/16.
*/
'use strict';
import React, { Component } from 'react';
import {Image, View, Platform, StyleSheet, ActivityIndicator, Dimensions, Text} from 'react-native';
var ProgressBar = require('ProgressBarAndroid');
var {width: windowWidth, height:windowHeight} = Dimensions.get('window');
var NAVBAR_HEIGHT = (Platform.OS === 'ios') ? 64 : 54;
var styles = StyleSheet.create({
loading:{
flexDirection: 'row'
},
loadingImg:{
width: 20,
height: 20,
marginRight: 6,
backgroundColor: 'transparent',
},
iosActivity:{
height: 40,
width: 40
}
});
var CustomActivityIndicator = React.createClass({
render: function(){
var indicator;
if (Platform.OS === 'ios'){
indicator = <ActivityIndicator animating={true} size="small" style={styles.iosActivity} color={"gray"}/>
}else{
indicator = <ProgressBar styleAttr={"Small"} color={"gray"} style={{padding: 10, marginTop: 15}}/>
}
return (
<View style={{height:windowHeight - NAVBAR_HEIGHT - NAVBAR_HEIGHT, justifyContent: "center", alignItems: "center" }}>
<View style={{flexDirection: "row", justifyContent: "center", alignItems: "center"}}>
{indicator}
</View>
</View>
)
}
});
module.exports = CustomActivityIndicator;