Repository navigation
Expand file tree
/
Copy pathPieProgress.js
More file actions
66 lines (62 loc) · 1.52 KB
/
Copy pathPieProgress.js
File metadata and controls
66 lines (62 loc) · 1.52 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
60
61
62
63
64
65
66
/*
Copyright © SuperMap. All rights reserved.
Author: Yang Shanglong
E-mail: yangshanglong@supermap.com
*/
import React, { Component } from 'react'
import { View, Image, StyleSheet } from 'react-native'
import PropTypes from 'prop-types'
import { Pie } from 'react-native-progress'
import { scaleSize } from '../../utils'
const styles = StyleSheet.create({
container: {},
img: {
position: 'absolute',
top: 0,
left: 0,
backgroundColor: 'transparent',
},
progress: {},
})
export default class PieProgress extends Component {
static propTypes = {
...View.propTypes,
progress: PropTypes.number, //当前进度 0 - 1
indeterminate: PropTypes.bool, // 不确定进度
size: PropTypes.number, // 大小
}
static defaultProps = {
size: scaleSize(18),
}
render() {
return (
<View
style={[
styles.container,
{
width: this.props.size + 1,
height: this.props.size + 1,
},
this.props.style,
]}
onLayout={this._onLayout}
>
<Pie
size={this.props.size}
style={styles.progress}
progress={this.props.progress}
indeterminate={false}
/>
{this.props.progress === 1 && (
<Image
source={require('../../assets/public/icon_share_completed.png')}
style={[
styles.img,
{ width: this.props.size, height: this.props.size },
]}
/>
)}
</View>
)
}
}