@@ -34,24 +34,25 @@ export default class CircularProgress extends React.PureComponent {
3434 lineCap,
3535 arcSweepAngle,
3636 fill,
37+ fillTransparency,
3738 children,
3839 childrenContainerStyle,
3940 padding,
4041 renderCap,
4142 dashedBackground,
43+ dashedFill
4244 } = this . props ;
4345
4446 const maxWidthCircle = backgroundWidth ? Math . max ( width , backgroundWidth ) : width ;
4547 const sizeWithPadding = size / 2 + padding / 2 ;
4648 const radius = size / 2 - maxWidthCircle / 2 - padding / 2 ;
4749
48-
4950 const currentFillAngle = ( arcSweepAngle * this . clampFill ( fill ) ) / 100 ;
50- const backgroundPath = this . circlePath (
51+ const backgroundPath = this . circlePath (
5152 sizeWithPadding ,
5253 sizeWithPadding ,
5354 radius ,
54- currentFillAngle ,
55+ fillTransparency ? 0 : currentFillAngle ,
5556 arcSweepAngle
5657 ) ;
5758 const circlePath = this . circlePath (
@@ -86,13 +87,14 @@ export default class CircularProgress extends React.PureComponent {
8687 ...childrenContainerStyle ,
8788 }
8889
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 ;
9294
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 ) )
9698 : null ;
9799
98100 return (
@@ -105,7 +107,7 @@ export default class CircularProgress extends React.PureComponent {
105107 stroke = { backgroundColor }
106108 strokeWidth = { backgroundWidth || width }
107109 strokeLinecap = { lineCap }
108- strokeDasharray = { strokeDasharray }
110+ strokeDasharray = { strokeDasharrayBackground }
109111 fill = "transparent"
110112 />
111113 ) }
@@ -115,7 +117,7 @@ export default class CircularProgress extends React.PureComponent {
115117 stroke = { tintColor }
116118 strokeWidth = { width }
117119 strokeLinecap = { lineCap }
118- strokeDasharray = { strokeDasharray }
120+ strokeDasharray = { strokeDasharrayFill }
119121 fill = "transparent"
120122 />
121123 ) }
@@ -132,6 +134,7 @@ CircularProgress.propTypes = {
132134 style : ViewPropTypes . style ,
133135 size : PropTypes . number . isRequired ,
134136 fill : PropTypes . number . isRequired ,
137+ fillTransparency : PropTypes . boolean ,
135138 width : PropTypes . number . isRequired ,
136139 backgroundWidth : PropTypes . number ,
137140 tintColor : PropTypes . string ,
@@ -144,6 +147,7 @@ CircularProgress.propTypes = {
144147 padding : PropTypes . number ,
145148 renderCap : PropTypes . func ,
146149 dashedBackground : PropTypes . object ,
150+ dashedFill : PropTypes . object
147151} ;
148152
149153CircularProgress . defaultProps = {
@@ -153,4 +157,6 @@ CircularProgress.defaultProps = {
153157 arcSweepAngle : 360 ,
154158 padding : 0 ,
155159 dashedBackground : { width : 0 , gap : 0 } ,
160+ dashedFill : { width : 0 , gap : 0 } ,
161+ fillTransparency : true
156162} ;
0 commit comments