Bugfix CXTDT-619833 - pagination fix

This commit is contained in:
Nandhini Rajendran 2024-10-21 23:07:48 +05:30
parent 8212d7146c
commit 4dec2388ae

View File

@ -111,7 +111,9 @@ open class Carousel: View {
/// Updates if the pager is visible or not.
private func updatePagerVisibility() {
guard let pagingView = pagingView else { return }
let shouldHidePager = collectionView.contentSize.width < bounds.width
// Consider hidesForSinglePage only if numberOfPages is less than 2
let hidePager = (numberOfPages < 2) ? ((pagingView.model as? CarouselPagingModelProtocol)?.hidesForSinglePage ?? true) : false
let shouldHidePager = (collectionView.contentSize.width < bounds.width) && hidePager
if (shouldHidePager && !pagingView.isHidden) || (!shouldHidePager && pagingView.isHidden) {
pagingView.isHidden = shouldHidePager
pagingBottomPin?.isActive = !shouldHidePager
@ -491,6 +493,7 @@ extension Carousel: UICollectionViewDelegate {
adjustedIndex = adjustedIndex + numberOfPages
}
model.selectedIndex = adjustedIndex
pagingView?.currentIndex = adjustedIndex
}
if let cell = collectionView.cellForItem(at: indexPath) as? CollectionTemplateItemProtocol {
cell.didSelectCell(at: indexPath, delegateObject: delegateObject, additionalData: nil)