javascript - React Native Animation实验性回调?

标签 javascript react-native

我一直在研究 React Native 和动画,并且希望以串行或链式动画的形式一起运行动画。动画完成时是否会触发 promise 或回调?这是我到目前为止所拥有的:

AnimationExperimental.startAnimation({
    node: this.refs['this'],
    duration: 500,
    easing: 'easeInOutCubic',
    property: 'scaleXY',
    toValue: [2,2],
    callback: () => {  // This doesn't work but you get the idea.
        console.log("callback called!");
    }
});

更新:

我发现 AnimationExperimental 已被弃用。 Facebook 正在开发一个不同的动画库,应该很快就会上线。您还可以查看react-native-gsap如果您等不及 Facebook 或者 AminationExerimental 不适合您,请访问图书馆

最佳答案

回调是第二个参数:

AnimationExperimental.startAnimation({
    node: this.refs['this'],
    duration: 500,
    easing: 'easeInOutCubic',
    property: 'scaleXY',
    toValue: [2,2]
}, () => {
        console.log("callback called!");
});

关于javascript - React Native Animation实验性回调?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30940769/

相关文章:

react native 中的蓝牙

javascript - 如何将这些 ng-init 移动到 Controller 中?

javascript - 使用 .match() 返回未定义的 0

javascript - Chart.js 选项和文档

javascript - 添加后缀后跟用户输入 Material ui TextField

android - 如何在VSC中运行和调试React Native Android应用程序?

javascript - 针对 Wordpress 对 Node.js 中的请求进行身份验证

android - 无法从 Assets 'index.android.bundle' 加载脚本

ios - 使用 React-native 的 IOS 版 Google SignIn(博览会)

javascript - 在开发和生产模式之间切换