Skip to content

Commit 7b23c13

Browse files
authored
fix: vertical scroll progress (#153)
Piotr Trocki <[email protected]>
1 parent 4fe7247 commit 7b23c13

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

ios/ReactNativePageView.m

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,12 @@ - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
511511

512512
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
513513
CGPoint point = scrollView.contentOffset;
514-
float offset = (point.x - self.frame.size.width)/self.frame.size.width;
514+
float offset = 0;
515+
if (_orientation == UIPageViewControllerNavigationOrientationHorizontal) {
516+
offset = (point.x - self.frame.size.width)/self.frame.size.width;
517+
} else {
518+
offset = (point.y - self.frame.size.height)/self.frame.size.height;
519+
}
515520
if(fabs(offset) > 1) {
516521
offset = offset > 0 ? 1.0 : -1.0;
517522
}

0 commit comments

Comments
 (0)