使用v0.20 React Native"this._easing不是函数"

Lab*_*tis 6 reactjs react-native

我在某些页面上遇到此错误,而不是全部,但无法将其跟踪到我的代码中的任何内容.

来自模拟器的红色错误模态:

this._easing is not a function. (In 'this._easing((now-this._startTime)/this.duration)', 'this._easing is NaN')


onUpdate
AnimatedImplementation.js @ 216:8

CallTimer

callTimers

__callFunction

<unknown>

guard

CallFunctionreturnFlusedQueue
Run Code Online (Sandbox Code Playgroud)

将项目升级到v0.20,清理xcode的构建/运行和捆绑以防万一.我很确定我的代码也没有使用动画库.

Bra*_*ugh 8

这是一篇较旧的帖子,但我通过Google发现了这一点,所以希望这可以帮助其他人.

对于bounceease渐变效果,你不需要调用该函数,如果你没有修改默认PARAMS.

// this should error
Animated.timing(this.state.animatedValue, {
  toValue: 10,
  duration: 300,
  easing: Easing.bounce()
}).start();
Run Code Online (Sandbox Code Playgroud)

如果您只是传递引用bounce,则错误将消失.

easing: Easing.bounce
Run Code Online (Sandbox Code Playgroud)