mirror of
https://github.com/divkit/divkit.git
synced 2026-06-06 20:07:59 +00:00
fix ios tabs
Pull Request resolved: https://github.com/divkit/divkit-ios/pull/6 commit_hash:e043707fa17954429fcab6ddfd362a52afc70dbd
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user