-
Notifications
You must be signed in to change notification settings - Fork 36
/
indicator.js
40 lines (36 loc) · 866 Bytes
/
indicator.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
var React = require('react-native');
var NativeMethodsMixin = require('NativeMethodsMixin')
var {
View,
StyleSheet,
Text
} = React;
class Indicator extends React.Component {
getText() {
switch (this.props.status) {
case 'pull':
if (this.props.threshold > 1) {
return 'Release to refresh'
}
return `Pull to refresh ${this.props.threshold}`
break;
case 'loading':
return 'Loading...'
break;
}
return null;
}
render() {
if (!this.props.status) return null;
return(<Text style={styles.text}>
{this.getText()}
</Text>);
}
}
Indicator.defaultProps = {
height: 30,
position: 'top'
}
var styles = StyleSheet.create({
});
module.exports = Indicator