Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ios]Fixed the problem that the list was not automatically restored when the loading tag was pulled up under certain conditions #3300

Merged
merged 1 commit into from
Sep 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[ios]Fixed the problem that the list was not automatically restored w…
…hen the loading tag was pulled up under certain conditions

复现条件:
list标签数据不超过一屏时,同时存在refresh和loading标签,若上拉加载列表(没有更多数据),仅仅快速切换(100ms)loading标签的display属性由true为false,发现列表位置不会自动还原

原因:
Probably setContentOffset: has higher priority than setContentOffset:animated:

方案:
参考refresh标签的说明,针对displayState字段不同值,调整设置setContentOffset方式
  • Loading branch information
yuditxj committed May 24, 2022
commit 28cfeea35a231411107e7894a251b90f1e5e78ca
10 changes: 7 additions & 3 deletions ios/sdk/WeexSDK/Sources/Component/WXLoadingComponent.mm
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,13 @@ - (void)setDisplay
}
if (contentOffset.y > 0) {
dispatch_async(dispatch_get_main_queue(), ^{
[UIView animateWithDuration:0.25 animations:^{
[scrollerProtocol setContentOffset:contentOffset animated:NO];
} completion:nil];
if (_displayState) {
[scrollerProtocol setContentOffset:contentOffset animated:YES];
} else {
[UIView animateWithDuration:0.25 animations:^{
[scrollerProtocol setContentOffset:contentOffset];
} completion:nil];
}
});
}
}
Expand Down