Skip to content

Commit

Permalink
fix(ios): return when user navigates to the same page (#760)
Browse files Browse the repository at this point in the history
  • Loading branch information
okwasniewski authored Aug 29, 2023
1 parent a03e44e commit 28973cc
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 28973cc

Please sign in to comment.