Skip to content

Commit

Permalink
fix(ios): improve accuracy of ViewPager's onPageScroll parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
wwwcg committed Aug 13, 2024
1 parent 50a59ac commit 39ddeda
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions ios/sdk/component/viewPager/HippyViewPager.m
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,18 @@ - (void)setPage:(NSInteger)pageNumber animated:(BOOL)animated {
[self setContentOffset:theItem.frame.origin animated:animated];
[self invokePageSelected:pageNumber];

if (self.onPageScrollStateChanged) {
if (animated) {
if (animated) {
if (self.onPageScrollStateChanged) {
HippyLogTrace(@"[HippyViewPager] settling --- (setPage withAnimation)");
self.onPageScrollStateChanged(@{ HippyPageScrollStateKey: HippyPageScrollStateSettling });
} else {
}
} else {
if (self.onPageScrollStateChanged) {
HippyLogTrace(@"[HippyViewPager] idle ~~~~~~ (setPage withoutAnimation)");
self.onPageScrollStateChanged(@{ HippyPageScrollStateKey: HippyPageScrollStateIdle });
}
// Record stop offset for onPageScroll callback
[self recordScrollStopOffsetX];
}
}

Expand Down

0 comments on commit 39ddeda

Please sign in to comment.