Code review. Include the only 1 element condition to the carousel pager logic.

This commit is contained in:
Hedden, Kyle Matthew 2024-03-11 10:45:55 -04:00
parent 73d13ba37b
commit 959bdce13f

View File

@ -143,7 +143,7 @@ open class Carousel: View {
// 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
let shouldHidePager = molecules?.count ?? 0 < 2 || collectionView.contentSize.width < bounds.width
if let pagingView = pagingView, shouldHidePager != pagingView.isHidden {
pagingView.isHidden = shouldHidePager
pagingBottomPin?.isActive = !shouldHidePager