Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何获取AnimatedInterpolation的值_Javascript_Typescript_React Native - Fatal编程技术网

Javascript 如何获取AnimatedInterpolation的值

Javascript 如何获取AnimatedInterpolation的值,javascript,typescript,react-native,Javascript,Typescript,React Native,我的问题是如何在react native中检索AnimatedInterpolation的值,而不调用私有代码 我创建动画值,并将其包裹在插值中,如下所示: animated = new Animated.Value(); interpolated = this.animated.interpolate({ inputRange:[0, 1000], outputRange:[0, 500] }) 我按如下方式渲染动画: <Animated.View st

我的问题是如何在react native中检索AnimatedInterpolation的值,而不调用私有代码

我创建动画值,并将其包裹在插值中,如下所示:

  animated = new Animated.Value();
  interpolated = this.animated.interpolate({
    inputRange:[0, 1000],
    outputRange:[0, 500]
  })
我按如下方式渲染动画:

  <Animated.View style={[{width: this.interpolated}]}/>
  this.animated.stopAnimation(v => {
    console.log(v, " ", this.interpolated.__getValue());
  })
可运行的示例


我的问题是,
\uu getValue()
是AnimatedInterpolation的私有成员,在使用typescript时会出现错误。我正在寻找一种声音方式来检索值,类似于
this.animated.stopAnimation
this.animated.\uu getValue()

我不知道为什么
animated.value
animated.AnimatedInterpolation
没有公共
\uu getValue()
等价物,或者为什么没有
AnimatedInterpolation.addEventListener
方法,类似于
Animated.Value.addEventListener
。对于一些效果,例如外部插值器,我还没有找到一种方法来使用
\uu getValue
,这让人不安。