Skip to content

Commit

Permalink
fix(#303): make sure onPageChanged will be called
Browse files Browse the repository at this point in the history
Page.pageIncrement will be reset to 0 only after ‚onPageChanged‘ has been called.
  • Loading branch information
geraldvoit authored and fermoya committed Sep 1, 2023
1 parent 00a5e3e commit 232675d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Sources/SwiftUIPager/PagerContent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -395,10 +395,14 @@ extension Pager.PagerContent {
}
withAnimation(animation) {
self.pagerModel.draggingOffset = 0
self.pagerModel.pageIncrement = pageIncrement
if pageIncrement != 0 {
self.pagerModel.pageIncrement = pageIncrement
}
if page != newPage {
self.pagerModel.index = newPage
}
self.pagerModel.draggingVelocity = 0
self.pagerModel.lastDraggingValue = nil
self.pagerModel.index = newPage
self.pagerModel.lastDigitalCrownPageOffset = CGFloat(pagerModel.index)
self.pagerModel.objectWillChange.send()
#if os(watchOS)
Expand Down

0 comments on commit 232675d

Please sign in to comment.