Skip to content

Commit

Permalink
Add ios non working pseudo-code for bounce control
Browse files Browse the repository at this point in the history
  • Loading branch information
lecler-i committed Mar 27, 2018
1 parent 8de040f commit 3321c9b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions ios/RCTDirectedScrollView/DirectedScrollViewManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,22 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView
[super scrollViewDidScroll:scrollView];
UIView *contentView = [self contentView];

//FIXME: Pseudo code... a checker
if (!self.verticalBounceEnabled) {
if (scrollView.contentOffset.y >= scrollView.contentSize.height - scrollView.frame.size.height) {
scrollView.setContentOffset(CGPointMake(scrollView.contentOffset.x, scrollView.contentSize.height - scrollView.frame.size.height), animated: false)
} else if (scrollView.contentOffset.y < 0)
scrollView.setContentOffset(CGPointMake(scrollView.contentOffset.x, 0), animated: false)
}
}
if (!self.horizontalBounceEnabled) {
if (scrollView.contentOffset.x >= scrollView.contentSize.width - scrollView.frame.size.width) {
scrollView.setContentOffset(CGPointMake(scrollView.contentSize.width - scrollView.frame.size.width, scrollView.contentOffset.y), animated: false)
} else if (scrollView.contentOffset.y < 0)
scrollView.setContentOffset(CGPointMake(0, scrollView.contentOffset.y), animated: false)
}
}

for (UIView *subview in contentView.reactSubviews)
{
DirectedScrollViewChild *scrollableChild = (DirectedScrollViewChild*)subview;
Expand Down

0 comments on commit 3321c9b

Please sign in to comment.