Skip to content

Commit

Permalink
Fix the PagerState.targetPage when the currentPageOffset between -0.5…
Browse files Browse the repository at this point in the history
…f and 0f,the targetPage is currentPage + 1 which is wrong, it should be currentPage - 1.
  • Loading branch information
MuffinMyHeart authored and andkulikov committed Dec 3, 2021
1 parent 6e04800 commit 0a8a103
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class PagerState(
// If the offset is 0f (or very close), return the current page
currentPageOffset.absoluteValue < 0.001f -> currentPage
// If we're offset towards the start, guess the previous page
currentPageOffset < -0.5f -> (currentPage - 1).coerceAtLeast(0)
currentPageOffset < 0f -> (currentPage - 1).coerceAtLeast(0)
// If we're offset towards the end, guess the next page
else -> (currentPage + 1).coerceAtMost(pageCount - 1)
}
Expand Down

0 comments on commit 0a8a103

Please sign in to comment.