fermoya / SwiftUIPager

Native Pager in SwiftUI
MIT License
1.29k stars 171 forks source link

[BUG] loopPages() with small number of items is animating to wrong end of the Pager. #244

Closed mikepitre closed 2 years ago

mikepitre commented 2 years ago

Describe the bug When using loopPages() with a small number of items (eg. 3), if I swipe on the last item, the pager scrolls all the way back to the beginning (or end) instead of just scrolling to the next item.

To Reproduce

In the InfiniteExampleView, set data2 to Array(0..<3) Apply the modifier .loopPages(true, repeating: 10) on the looping pager. Attempt to page through the end of the Pager. Try in both directions.

Expected behavior

I expected the pager to scroll forward to the next item (which would be the item at index 0). (And I would expect the opposite when going in the other direction as well)

Screenshots / Videos

https://user-images.githubusercontent.com/12040919/147604197-d6b92aaf-0532-4f83-9b7f-0b3863a29505.mp4

Environment:

fermoya commented 2 years ago

hi @mikepitre , apologies for the late response. This should be fixed here: https://github.com/fermoya/SwiftUIPager/releases/tag/2.3.3-beta.3

mikepitre commented 2 years ago

ty @fermoya !