gpt4 book ai didi

react-native - 在 React Native 中使用 requestAnimationFrame

转载 作者:行者123 更新时间:2023-12-04 04:55:21 24 4
gpt4 key购买 nike

如何在 React Native 中使用 requestAnimationFrame。
我用它来表现像这样的 TouchableOpacity

this.requestAnimationFrame(() => {
if (this.state.scrollEnabled)
this._panel.transitionTo({toValue: 0});
else {
this.setState({scrollEnabled: true}, () => {
this._panel.transitionTo({toValue: height})
})
}
});
并返回此错误

this.requestAnimationFrame is not a function

最佳答案

您必须删除 this从第一行:

requestAnimationFrame(() => {
....
});

关于react-native - 在 React Native 中使用 requestAnimationFrame,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51258292/

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