Skip to content

Commit 3321c9b

Browse files
author
Thomas LECLERCQ
committed
Add ios non working pseudo-code for bounce control
1 parent 8de040f commit 3321c9b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

ios/RCTDirectedScrollView/DirectedScrollViewManager.m

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,22 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView
2424
[super scrollViewDidScroll:scrollView];
2525
UIView *contentView = [self contentView];
2626

27+
//FIXME: Pseudo code... a checker
28+
if (!self.verticalBounceEnabled) {
29+
if (scrollView.contentOffset.y >= scrollView.contentSize.height - scrollView.frame.size.height) {
30+
scrollView.setContentOffset(CGPointMake(scrollView.contentOffset.x, scrollView.contentSize.height - scrollView.frame.size.height), animated: false)
31+
} else if (scrollView.contentOffset.y < 0)
32+
scrollView.setContentOffset(CGPointMake(scrollView.contentOffset.x, 0), animated: false)
33+
}
34+
}
35+
if (!self.horizontalBounceEnabled) {
36+
if (scrollView.contentOffset.x >= scrollView.contentSize.width - scrollView.frame.size.width) {
37+
scrollView.setContentOffset(CGPointMake(scrollView.contentSize.width - scrollView.frame.size.width, scrollView.contentOffset.y), animated: false)
38+
} else if (scrollView.contentOffset.y < 0)
39+
scrollView.setContentOffset(CGPointMake(0, scrollView.contentOffset.y), animated: false)
40+
}
41+
}
42+
2743
for (UIView *subview in contentView.reactSubviews)
2844
{
2945
DirectedScrollViewChild *scrollableChild = (DirectedScrollViewChild*)subview;

0 commit comments

Comments
 (0)