Skip to content

Commit 386c736

Browse files
committed
fixes: UIPageControl component does not scroll page when tapped.
1 parent fb1ea98 commit 386c736

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ios/ReactNativePageView.m

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,8 +483,17 @@ - (UIPageControl *)createPageIndicator:(UIView *)parentView {
483483
pageControl.tintColor = UIColor.blackColor;
484484
pageControl.pageIndicatorTintColor = UIColor.whiteColor;
485485
pageControl.currentPageIndicatorTintColor = UIColor.blackColor;
486+
[pageControl addTarget:self
487+
action:@selector(pageControlValueChanged:)
488+
forControlEvents:UIControlEventValueChanged];
489+
486490
return pageControl;
487491
}
492+
- (void)pageControlValueChanged:(UIPageControl *)sender {
493+
if (_reactPageIndicatorView.currentPage != _currentIndex) {
494+
[self goTo:@(_reactPageIndicatorView.currentPage) animated:YES];
495+
}
496+
}
488497

489498
#pragma mark - UIScrollViewDelegate
490499

0 commit comments

Comments
 (0)