File tree Expand file tree Collapse file tree 2 files changed +20
-8
lines changed Expand file tree Collapse file tree 2 files changed +20
-8
lines changed Original file line number Diff line number Diff line change @@ -48,12 +48,20 @@ declare module 'react-native-circular-progress' {
48
48
tintColor ?: string ;
49
49
50
50
/**
51
- * Change the fill color from tintColor to tintColorSecondary as animation progresses.
52
- *
51
+ * Change the fill color from the first to the second color as animation progresses.
52
+ *
53
+ * @type {string }
54
+ * @default 'undefined'
55
+ */
56
+ secondTintColor ?: string ;
57
+
58
+ /**
59
+ * Change the fill color from the second color to the third color as animation progresses.
60
+ *
53
61
* @type {string }
54
62
* @default 'undefined'
55
63
*/
56
- tintColorSecondary ?: string ;
64
+ thirdTintColor ?: string ;
57
65
58
66
/**
59
67
* Current progress / tint transparency
@@ -181,7 +189,7 @@ declare module 'react-native-circular-progress' {
181
189
182
190
export class AnimatedCircularProgress extends React . Component <
183
191
AnimatedCircularProgressProps
184
- > {
192
+ > {
185
193
/**
186
194
* Animate the progress bar to a specific value
187
195
*
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ export default class AnimatedCircularProgress extends React.PureComponent {
36
36
const duration = dur || this . props . duration ;
37
37
const easing = ease || this . props . easing ;
38
38
const useNativeDriver = this . props . useNativeDriver ;
39
-
39
+
40
40
const anim = Animated . timing ( this . state . fillAnimation , {
41
41
useNativeDriver,
42
42
toValue,
@@ -49,13 +49,17 @@ export default class AnimatedCircularProgress extends React.PureComponent {
49
49
}
50
50
51
51
animateColor ( ) {
52
- if ( ! this . props . tintColorSecondary ) {
52
+ if ( ! this . props . secondTintColor ) {
53
53
return this . props . tintColor
54
54
}
55
55
56
+ if ( ! this . props . thirdTintColor ) {
57
+ return this . props . secondTintColor
58
+ }
59
+
56
60
const tintAnimation = this . state . fillAnimation . interpolate ( {
57
- inputRange : [ 0 , 100 ] ,
58
- outputRange : [ this . props . tintColor , this . props . tintColorSecondary ]
61
+ inputRange : [ 0 , 50 , 100 ] ,
62
+ outputRange : [ this . props . tintColor , this . props . secondTintColor , this . props . thirdTintColor ]
59
63
} )
60
64
61
65
return tintAnimation
You can’t perform that action at this time.
0 commit comments