React-Native .scrollTo 与 InteractionManager 不工作
React-Native .scrollTo with InteractionManager not working
我正在尝试获取应用程序在 x:(device.width*2) 的初始位置,因为该应用程序包含 3 个主要视图,但即使有动画,它似乎也没有移动延迟,它从左视图开始。
componentDidMount() {
const offset = window.width * this.props.initialIndex;
InteractionManager.runAfterInteractions(() => {
this._scrollView.scrollTo({x:offset, animated: false});
})
}
我也尝试过交互管理器,但我不知道为什么它不起作用;设置超时对我有用。
setTimeout(() => {
this.scrollView.scrollTo(cordenates, animated);
}, 0);
我正在尝试获取应用程序在 x:(device.width*2) 的初始位置,因为该应用程序包含 3 个主要视图,但即使有动画,它似乎也没有移动延迟,它从左视图开始。
componentDidMount() {
const offset = window.width * this.props.initialIndex;
InteractionManager.runAfterInteractions(() => {
this._scrollView.scrollTo({x:offset, animated: false});
})
}
我也尝试过交互管理器,但我不知道为什么它不起作用;设置超时对我有用。
setTimeout(() => {
this.scrollView.scrollTo(cordenates, animated);
}, 0);