/**
Make the tapped cell the current if isInfinity is true
- parameter index: Next IndexPath√
*/
fileprivate func updateCurrentIndexForTap(_ index: Int) {
deselectVisibleCells()
if isInfinity && (index < pageTabItemsCount) || (index >= pageTabItemsCount * 2) {
currentIndex = (index < pageTabItemsCount) ? index + pageTabItemsCount : index - pageTabItemsCount
shouldScrollToItem = true
} else {
currentIndex = index
}
let indexPath = IndexPath(item: index, section: 0) // FIX: index -> currentIndex
moveCurrentBarView(indexPath, animated: true, shouldScroll: true)
}
As a result of this mistake, when isInfinity is true, it causes a weird animation when moving tab from the range of pageTabItemsCount <= currentIndex < pageTabItemsCount * 2 to the range of currentIndex < pageTabItemsCount && pageTabItemsCount * 2 <= currentIndex.
I guess it's just a mistake. The following code is using
index
, but it should becurrentIndex
. https://github.com/EndouMari/TabPageViewController/blob/master/Sources/TabView.swift#L224The below is the exact part.
As a result of this mistake, when
isInfinity
is true, it causes a weird animation when moving tab from the range ofpageTabItemsCount <= currentIndex < pageTabItemsCount * 2
to the range ofcurrentIndex < pageTabItemsCount && pageTabItemsCount * 2 <= currentIndex
.