11import { SpringValue } from '../types/animated'
22import { InterpolationConfig } from '../types/interpolation'
33import Animated , { AnimatedArray } from './Animated'
4- import createInterpolator from './createInterpolator'
4+ import createInterpolator , { ExtrapolateType } from './createInterpolator'
55
66type IpValue = string | number | ( string | number ) [ ]
77// The widest possible interpolator type, possible if interpolate() is passed
@@ -15,7 +15,8 @@ export default class AnimatedInterpolation extends AnimatedArray<Animated>
1515 constructor (
1616 parents : Animated | Animated [ ] ,
1717 range : number [ ] | InterpolationConfig | Interpolator ,
18- output ?: ( number | string ) [ ]
18+ output ?: ( number | string ) [ ] ,
19+ extrapolate ?: ExtrapolateType
1920 ) {
2021 super ( )
2122 this . payload =
@@ -25,7 +26,11 @@ export default class AnimatedInterpolation extends AnimatedArray<Animated>
2526 : Array . isArray ( parents )
2627 ? parents
2728 : [ parents ]
28- this . calc = createInterpolator ( range as number [ ] , output ! ) as Interpolator
29+ this . calc = createInterpolator (
30+ range as number [ ] ,
31+ output ! ,
32+ extrapolate
33+ ) as Interpolator
2934 }
3035
3136 public getValue ( ) {
@@ -34,15 +39,26 @@ export default class AnimatedInterpolation extends AnimatedArray<Animated>
3439
3540 public updateConfig (
3641 range : number [ ] | InterpolationConfig | Interpolator ,
37- output ?: ( number | string ) [ ]
42+ output ?: ( number | string ) [ ] ,
43+ extrapolate ?: ExtrapolateType
3844 ) {
39- this . calc = createInterpolator ( range as number [ ] , output ! ) as Interpolator
45+ this . calc = createInterpolator (
46+ range as number [ ] ,
47+ output ! ,
48+ extrapolate
49+ ) as Interpolator
4050 }
4151
4252 public interpolate (
4353 range : number [ ] | InterpolationConfig | ( ( ...args : any [ ] ) => IpValue ) ,
44- output ?: ( number | string ) [ ]
54+ output ?: ( number | string ) [ ] ,
55+ extrapolate ?: ExtrapolateType
4556 ) : AnimatedInterpolation {
46- return new AnimatedInterpolation ( this , range as number [ ] , output ! )
57+ return new AnimatedInterpolation (
58+ this ,
59+ range as number [ ] ,
60+ output ! ,
61+ extrapolate
62+ )
4763 }
4864}
0 commit comments