diff --git a/client/ios/LayoutKit/LayoutKit/UI/Views/TabbedPages/TabContentsView.swift b/client/ios/LayoutKit/LayoutKit/UI/Views/TabbedPages/TabContentsView.swift index 03dd92876..4523d57d3 100644 --- a/client/ios/LayoutKit/LayoutKit/UI/Views/TabbedPages/TabContentsView.swift +++ b/client/ios/LayoutKit/LayoutKit/UI/Views/TabbedPages/TabContentsView.swift @@ -73,6 +73,8 @@ final class TabContentsView: BlockView { private var scrolledPageIndex: CGFloat = 0 + private var isAnimatingTransition = false + var visibleBoundsTrackingSubviews: [VisibleBoundsTrackingView] { collectionView.asArray() } var effectiveBackgroundColor: UIColor? { backgroundView?.effectiveBackgroundColor } @@ -199,7 +201,9 @@ final class TabContentsView: BlockView { collectionView.isScrollEnabled = model.scrollingEnabled if oldModel != model || layout == nil || state.selectedPageIndex != selectedPageIndex { - updateSelectedPageIndexIfNeeded(state.selectedPageIndex) + if !isAnimatingTransition { + updateSelectedPageIndexIfNeeded(state.selectedPageIndex) + } setNeedsLayout() } } @@ -232,6 +236,7 @@ final class TabContentsView: BlockView { } private func updateContentOffset() { + isAnimatingTransition = true collectionView.setContentOffset(selectedPageContentOffset, animated: true) } @@ -271,6 +276,7 @@ extension TabContentsView: UICollectionViewDelegate { func scrollViewDidEndScrollingAnimation(_ scrollView: UIScrollView) { overscrollDelegate?.onDidEndScrollingAnimation(scrollView) + isAnimatingTransition = false delegate?.tabContentsViewDidEndAnimation() updateSelectedPageIndexFromRelativeContentOffset(isIntermediate: false) }