diff --git a/ios/Fabric/RNCPagerViewComponentView.mm b/ios/Fabric/RNCPagerViewComponentView.mm index d9905890..652a5c12 100644 --- a/ios/Fabric/RNCPagerViewComponentView.mm +++ b/ios/Fabric/RNCPagerViewComponentView.mm @@ -22,7 +22,9 @@ @interface RNCPagerViewComponentView () *)childCompo -(void)updateLayoutMetrics:(const facebook::react::LayoutMetrics &)layoutMetrics oldLayoutMetrics:(const facebook::react::LayoutMetrics &)oldLayoutMetrics { - [super updateLayoutMetrics:layoutMetrics oldLayoutMetrics:_layoutMetrics]; - self.contentView.frame = RCTCGRectFromRect(layoutMetrics.getContentFrame()); + _oldLayoutMetrics = oldLayoutMetrics; _layoutMetrics = layoutMetrics; + + if (transitioning) { + return; + } + + [super updateLayoutMetrics:layoutMetrics oldLayoutMetrics:_layoutMetrics]; } @@ -223,12 +230,15 @@ - (void)setPagerViewControllers:(NSInteger)index [self enableSwipe]; return; } - + + transitioning = YES; + __weak RNCPagerViewComponentView *weakSelf = self; [_nativePageViewController setViewControllers:@[[_nativeChildrenViewControllers objectAtIndex:index]] direction:direction animated:animated completion:^(BOOL finished) { + self->transitioning = NO; __strong RNCPagerViewComponentView *strongSelf = weakSelf; [strongSelf enableSwipe]; if (strongSelf->_eventEmitter != nullptr ) { @@ -237,6 +247,7 @@ - (void)setPagerViewControllers:(NSInteger)index strongEventEmitter.onPageSelected(RNCViewPagerEventEmitter::OnPageSelected{.position = static_cast(position)}); strongSelf->_currentIndex = index; } + [strongSelf updateLayoutMetrics:strongSelf->_layoutMetrics oldLayoutMetrics:strongSelf->_oldLayoutMetrics]; }]; }