Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6208

How to get value of AnimatedInterpolation

$
0
0

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().


Viewing all articles
Browse latest Browse all 6208

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>