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' {
4848 tintColor ?: string ;
4949
5050 /**
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+ *
5361 * @type {string }
5462 * @default 'undefined'
5563 */
56- tintColorSecondary ?: string ;
64+ thirdTintColor ?: string ;
5765
5866 /**
5967 * Current progress / tint transparency
@@ -181,7 +189,7 @@ declare module 'react-native-circular-progress' {
181189
182190 export class AnimatedCircularProgress extends React . Component <
183191 AnimatedCircularProgressProps
184- > {
192+ > {
185193 /**
186194 * Animate the progress bar to a specific value
187195 *
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ export default class AnimatedCircularProgress extends React.PureComponent {
3636 const duration = dur || this . props . duration ;
3737 const easing = ease || this . props . easing ;
3838 const useNativeDriver = this . props . useNativeDriver ;
39-
39+
4040 const anim = Animated . timing ( this . state . fillAnimation , {
4141 useNativeDriver,
4242 toValue,
@@ -49,13 +49,17 @@ export default class AnimatedCircularProgress extends React.PureComponent {
4949 }
5050
5151 animateColor ( ) {
52- if ( ! this . props . tintColorSecondary ) {
52+ if ( ! this . props . secondTintColor ) {
5353 return this . props . tintColor
5454 }
5555
56+ if ( ! this . props . thirdTintColor ) {
57+ return this . props . secondTintColor
58+ }
59+
5660 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 ]
5963 } )
6064
6165 return tintAnimation
You can’t perform that action at this time.
0 commit comments