gpt4 book ai didi

javascript - React Native Animation实验性回调?

转载 作者:行者123 更新时间:2023-12-03 09:48:39 24 4
gpt4 key购买 nike

我一直在研究 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com