I have a question about how to access the value of an AnimatedInterpolation in react-native without resorting to calling private code.
To achieve this, I first create an animated value and then wrap it in an interpolation like so:
animated = new Animated.Value();
interpolated = this.animated.interpolate({
inputRange:[0, 1000],
outputRange:[0, 500]
})
The animation is rendered using the following code:
<Animated.View style={[{width: this.interpolated}]}/>
After rendering the animation, I attempt to retrieve the animated value with this method:
this.animated.stopAnimation(v => {
console.log(v, " ", this.interpolated.__getValue());
})
A live example can be found here.
My challenge lies in the fact that __getValue()
is considered a private member of AnimatedInterpolation, causing issues when incorporating typescript. I am seeking a reliable method to obtain the value similar to the use of this.animated.stopAnimation
over this.animated.__getValue()
.