Skip to content

Conversation

@masatootake
Copy link

I guess it's just a mistake. The following code is using index, but it should be currentIndex.
https://github.com/EndouMari/TabPageViewController/blob/master/Sources/TabView.swift#L224

The below is the exact part.

    /**
     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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant