Skip to content

Commit 27e8003

Browse files
authored
fix(ios): rapid taps on the navigation tabs (#529)
1 parent 08d5c78 commit 27e8003

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

ios/ReactNativePageView.m

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,17 @@ - (void)setReactViewControllers:(NSInteger)index
184184
if (animated == YES) {
185185
self.animating = YES;
186186
}
187+
188+
//
189+
// If 'controller' is the current visible controller and the 'animated' flag is set to YES,
190+
// then 'setViewControllers' is called without invoking the completion handler. This can block the navigation from working.
191+
// So we need to check if that would be the case, and if so, we will not perform animation.
192+
//
193+
BOOL canAnimate = (controller != [[self.reactPageViewController viewControllers] firstObject] );
187194

188195
[self.reactPageViewController setViewControllers:@[controller]
189196
direction:direction
190-
animated:animated
197+
animated:canAnimate?animated:NO
191198
completion:^(BOOL finished) {
192199
__strong typeof(self) strongSelf = weakSelf;
193200
strongSelf.currentIndex = index;

0 commit comments

Comments
 (0)