@@ -34,24 +34,25 @@ export default class CircularProgress extends React.PureComponent {
34
34
lineCap,
35
35
arcSweepAngle,
36
36
fill,
37
+ fillTransparency,
37
38
children,
38
39
childrenContainerStyle,
39
40
padding,
40
41
renderCap,
41
42
dashedBackground,
43
+ dashedFill
42
44
} = this . props ;
43
45
44
46
const maxWidthCircle = backgroundWidth ? Math . max ( width , backgroundWidth ) : width ;
45
47
const sizeWithPadding = size / 2 + padding / 2 ;
46
48
const radius = size / 2 - maxWidthCircle / 2 - padding / 2 ;
47
49
48
-
49
50
const currentFillAngle = ( arcSweepAngle * this . clampFill ( fill ) ) / 100 ;
50
- const backgroundPath = this . circlePath (
51
+ const backgroundPath = this . circlePath (
51
52
sizeWithPadding ,
52
53
sizeWithPadding ,
53
54
radius ,
54
- currentFillAngle ,
55
+ fillTransparency ? 0 : currentFillAngle ,
55
56
arcSweepAngle
56
57
) ;
57
58
const circlePath = this . circlePath (
@@ -86,13 +87,14 @@ export default class CircularProgress extends React.PureComponent {
86
87
...childrenContainerStyle ,
87
88
}
88
89
89
- const dashedBackgroundStyle = dashedBackground . gap > 0
90
- ? dashedBackground
91
- : { width :0 , gap :0 } ;
90
+ const strokeDasharrayFill = dashedFill . gap > 0 ?
91
+ Object . values ( dashedFill )
92
+ . map ( value => parseInt ( value ) )
93
+ : null ;
92
94
93
- const strokeDasharray = dashedBackground . gap > 0 ?
94
- Object . values ( dashedBackgroundStyle )
95
- . map ( value => parseInt ( value ) )
95
+ const strokeDasharrayBackground = dashedBackground . gap > 0 ?
96
+ Object . values ( dashedBackground )
97
+ . map ( value => parseInt ( value ) )
96
98
: null ;
97
99
98
100
return (
@@ -105,7 +107,7 @@ export default class CircularProgress extends React.PureComponent {
105
107
stroke = { backgroundColor }
106
108
strokeWidth = { backgroundWidth || width }
107
109
strokeLinecap = { lineCap }
108
- strokeDasharray = { strokeDasharray }
110
+ strokeDasharray = { strokeDasharrayBackground }
109
111
fill = "transparent"
110
112
/>
111
113
) }
@@ -115,7 +117,7 @@ export default class CircularProgress extends React.PureComponent {
115
117
stroke = { tintColor }
116
118
strokeWidth = { width }
117
119
strokeLinecap = { lineCap }
118
- strokeDasharray = { strokeDasharray }
120
+ strokeDasharray = { strokeDasharrayFill }
119
121
fill = "transparent"
120
122
/>
121
123
) }
@@ -132,6 +134,7 @@ CircularProgress.propTypes = {
132
134
style : ViewPropTypes . style ,
133
135
size : PropTypes . number . isRequired ,
134
136
fill : PropTypes . number . isRequired ,
137
+ fillTransparency : PropTypes . boolean ,
135
138
width : PropTypes . number . isRequired ,
136
139
backgroundWidth : PropTypes . number ,
137
140
tintColor : PropTypes . string ,
@@ -144,6 +147,7 @@ CircularProgress.propTypes = {
144
147
padding : PropTypes . number ,
145
148
renderCap : PropTypes . func ,
146
149
dashedBackground : PropTypes . object ,
150
+ dashedFill : PropTypes . object
147
151
} ;
148
152
149
153
CircularProgress . defaultProps = {
@@ -153,4 +157,6 @@ CircularProgress.defaultProps = {
153
157
arcSweepAngle : 360 ,
154
158
padding : 0 ,
155
159
dashedBackground : { width : 0 , gap : 0 } ,
160
+ dashedFill : { width : 0 , gap : 0 } ,
161
+ fillTransparency : true
156
162
} ;
0 commit comments