-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathprogress.js
83 lines (76 loc) · 2.28 KB
/
progress.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/**
* Created by ywu on 15/8/13.
*/
import React, { createRef } from 'react';
import { StyleSheet, Text, View, ScrollView } from 'react-native';
import { Progress, Spinner } from 'react-native-material-kit';
import appStyles from './styles';
const styles = Object.assign(
{},
appStyles,
StyleSheet.create({
progress: {
width: 150,
//height: 2,
},
spinner: {
// width: 22,
// height: 22,
},
})
);
export default class extends React.Component {
_progRef = createRef();
_progWithBufferRef = createRef();
constructor(props) {
super(props);
}
componentDidMount() {
setTimeout(() => {
const progBarWithBuffer = this._progWithBufferRef.current;
if (progBarWithBuffer) {
progBarWithBuffer.buffer = 0.8;
}
}, 1000);
setTimeout(() => {
const progBar = this._progRef.current;
const progBarWithBuffer = this._progWithBufferRef.current;
if (progBar && progBarWithBuffer) {
progBar.progress = 0.6;
progBarWithBuffer.progress = 0.6;
}
}, 1600);
}
render = () => (
<ScrollView style={styles.scrollView} contentContainerStyle={styles.container}>
<View style={styles.row}>
<View style={styles.col}>
<Progress ref={this._progRef} style={styles.progress} progress={0.2} />
<Text style={styles.legendLabel}>Default progress bar</Text>
</View>
</View>
<View style={styles.row}>
<View style={styles.col}>
<Progress.Indeterminate style={styles.progress} />
<Text style={styles.legendLabel}>Indeterminate</Text>
</View>
</View>
<View style={styles.row}>
<View style={styles.col}>
<Progress ref={this._progWithBufferRef} style={styles.progress} progress={0.2} buffer={0.3} />
<Text style={styles.legendLabel}>Buffering</Text>
</View>
</View>
<View style={styles.row}>
<View style={styles.col}>
<Spinner style={styles.spinner} />
<Text style={styles.legendLabel}>Default spinner</Text>
</View>
<View style={styles.col}>
<Spinner style={styles.spinner} strokeColor="purple" />
<Text style={styles.legendLabel}>Single color</Text>
</View>
</View>
</ScrollView>
);
}