Fixes for crash issue in carousel

This commit is contained in:
Tondapu, Alekhya 2021-07-23 00:47:38 +05:30
parent 707f256a39
commit d3e02c3bd0

View File

@ -79,7 +79,6 @@ open class Carousel: View {
DispatchQueue.main.async {
self.layoutCollection()
}
collectionView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
}
/// Invalidates the layout and ensures we are paged to the correct cell.
@ -211,9 +210,8 @@ open class Carousel: View {
open override func reset() {
super.reset()
currentIndex = 0
pageIndex = 0
pagingView?.reset()
collectionView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
}
var pagingMoleculeName: String?
@ -225,7 +223,7 @@ open class Carousel: View {
molecule.moleculeName == pagingMoleculeName {
pagingView?.set(with: molecule, delegateObject, nil)
pagingView?.numberOfPages = numberOfPages
pagingView?.currentIndex = currentIndex
//pagingView?.currentIndex = currentIndex
return
}
@ -434,7 +432,6 @@ extension Carousel: UICollectionViewDelegate {
}
model.selectedIndex = adjustedIndex
currentIndex = adjustedIndex
pageIndex = currentIndex
pagingView?.currentIndex = adjustedIndex
updateModelIndex()
}