Skip to content

Commit

Permalink
fix: return when user navigates to the same page
Browse files Browse the repository at this point in the history
  • Loading branch information
okwasniewski committed Aug 28, 2023
1 parent b962980 commit ad4b239
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ios/Fabric/RNCPagerViewComponentView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@ - (void)enableSwipe {
- (void)goTo:(NSInteger)index animated:(BOOL)animated {
NSInteger numberOfPages = _nativeChildrenViewControllers.count;

if (index == _currentIndex) {
return;
}

[self disableSwipe];

_destinationIndex = index;
Expand Down
4 changes: 4 additions & 0 deletions ios/ReactNativePageView.m
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@ - (void)enableSwipe {
- (void)goTo:(NSInteger)index animated:(BOOL)animated {
NSInteger numberOfPages = self.reactSubviews.count;

if (index == _currentIndex) {
return;
}

[self disableSwipe];

_destinationIndex = index;
Expand Down

0 comments on commit ad4b239

Please sign in to comment.