My question is how to retrieve the value of an AnimatedInterpolation in react-native, without calling private code.
I create the animated value and wrap it in an interpolation like this:
animated = new Animated.Value();
interpolated = this.animated.interpolate({
inputRange:[0, 1000],
outputRange:[0, 500]
})
I render the animation like this:
<Animated.View style={[{width: this.interpolated}]}/>
And I retrieve the animated value like this:
this.animated.stopAnimation(v => {
console.log(v, "", this.interpolated.__getValue());
})
Runnable example here.
My problem is that __getValue()
is a private member of AnimatedInterpolation and it gives an error when using typescript. I'm looking for a sound way to retrieve the value, similarly to how this.animated.stopAnimation
is sounder than this.animated.__getValue()
.