Pager should still hide on the empty condition.
This commit is contained in:
parent
2877534c70
commit
73d13ba37b
@ -96,12 +96,6 @@ open class Carousel: View {
|
|||||||
collectionView.scrollToItem(at: IndexPath(row: currentIndex, section: 0), at: itemAlignment, animated: false)
|
collectionView.scrollToItem(at: IndexPath(row: currentIndex, section: 0), at: itemAlignment, animated: false)
|
||||||
collectionView.layoutIfNeeded()
|
collectionView.layoutIfNeeded()
|
||||||
showPeaking(true)
|
showPeaking(true)
|
||||||
|
|
||||||
let shouldHidePager = model.molecules.isEmpty || collectionView.contentSize.width < bounds.width
|
|
||||||
if let pagingView = pagingView, shouldHidePager != pagingView.isHidden {
|
|
||||||
pagingView.isHidden = shouldHidePager
|
|
||||||
pagingBottomPin?.isActive = !shouldHidePager
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,6 +140,15 @@ open class Carousel: View {
|
|||||||
(cell as? MVMCoreViewProtocol)?.updateView(size)
|
(cell as? MVMCoreViewProtocol)?.updateView(size)
|
||||||
}
|
}
|
||||||
layoutCollection()
|
layoutCollection()
|
||||||
|
|
||||||
|
// Check must be dispatched to main for the layout to complete in layoutCollection.
|
||||||
|
DispatchQueue.main.async { [self] in
|
||||||
|
let shouldHidePager = molecules?.isEmpty ?? true || collectionView.contentSize.width < bounds.width
|
||||||
|
if let pagingView = pagingView, shouldHidePager != pagingView.isHidden {
|
||||||
|
pagingView.isHidden = shouldHidePager
|
||||||
|
pagingBottomPin?.isActive = !shouldHidePager
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user