[go: nahoru, domu]

Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
[iOS] Ignore scroll action if contentSize smaller than scroller frame.
Browse files Browse the repository at this point in the history
  • Loading branch information
huanglei.hl committed Apr 1, 2019
1 parent 36dce32 commit ae3607d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ios/sdk/WeexSDK/Sources/Component/WXListComponent.mm
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,13 @@ - (void)_handleFirstScreenTime

- (void)scrollToComponent:(WXComponent *)component withOffset:(CGFloat)offset animated:(BOOL)animated
{
UIScrollView *scrollView = (UIScrollView *)self.view;
// http://dotwe.org/vue/aa1af34e5fc745c0f1520e346904682a
// ignore scroll action if contentSize smaller than scroller frame
if (scrollView.contentSize.height < scrollView.frame.size.height) {
return;
}

CGPoint contentOffset = _tableView.contentOffset;
CGFloat contentOffsetY = 0;

Expand Down
9 changes: 9 additions & 0 deletions ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.mm
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,15 @@ - (void)removeScrollToListener:(WXComponent *)target
- (void)scrollToComponent:(WXComponent *)component withOffset:(CGFloat)offset animated:(BOOL)animated
{
UIScrollView *scrollView = (UIScrollView *)self.view;
// http://dotwe.org/vue/aa1af34e5fc745c0f1520e346904682a
// ignore scroll action if contentSize smaller than scroller frame
if (_scrollDirection == WXScrollDirectionVertical && scrollView.contentSize.height < scrollView.frame.size.height) {
return;
}
if (_scrollDirection == WXScrollDirectionHorizontal && scrollView.contentSize.width < scrollView.frame.size.width) {
return;
}


CGPoint contentOffset = scrollView.contentOffset;
CGFloat scaleFactor = self.weexInstance.pixelScaleFactor;
Expand Down

0 comments on commit ae3607d

Please sign in to comment.