Skip to content

Commit 28973cc

Browse files
authored
fix(ios): return when user navigates to the same page (#760)
1 parent a03e44e commit 28973cc

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

ios/Fabric/RNCPagerViewComponentView.mm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,10 @@ - (void)enableSwipe {
192192
- (void)goTo:(NSInteger)index animated:(BOOL)animated {
193193
NSInteger numberOfPages = _nativeChildrenViewControllers.count;
194194

195+
if (index == _currentIndex) {
196+
return;
197+
}
198+
195199
[self disableSwipe];
196200

197201
_destinationIndex = index;

ios/ReactNativePageView.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,10 @@ - (void)enableSwipe {
243243
- (void)goTo:(NSInteger)index animated:(BOOL)animated {
244244
NSInteger numberOfPages = self.reactSubviews.count;
245245

246+
if (index == _currentIndex) {
247+
return;
248+
}
249+
246250
[self disableSwipe];
247251

248252
_destinationIndex = index;

0 commit comments

Comments
 (0)