fix: Reset offset to 0 on swipe end to prevent indicator jump#12664
fix: Reset offset to 0 on swipe end to prevent indicator jump#12664AlexCernik wants to merge 1 commit into
Conversation
|
Hey @AlexCernik! Thanks for opening your first pull request in this repo. If you haven't already, make sure to read our contribution guidelines. |
✅ Deploy Preview for react-navigation-example ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
satya164
left a comment
There was a problem hiding this comment.
Thanks for the PR @AlexCernik
This seems like a bug in react-native-pager-view. Can you open a bug report there?
I'd rather not add a workaround and get the actual bug fixed instead.
|
And the change does not fix the problem, still it occurs. also some flickers on the tab indicator on tab press |
1573758 to
05ca74a
Compare
|
I can confirm that the bug is still present even with the proposed changes. |
|
To test the fix, update |
Note: the issue is reproducible on slow swipes too -- it's amplified by heavy screen content
Tested: RN 0.81.5, Fabric, Android, Expo SDK 54, react-native-tab-view 4.3.0, react-native-pager-view 6.9.1 |
|
It has been fixed here https://github.com/callstack/react-native-pager-view/releases/tag/v8.0.1 |
Summary
When swiping between tabs, especially in React Native's New Architecture or on some devices, the
offsetvalue may retain a small negative or positive value (e.g.-0.02) even after the swipe ends. This causes a visual glitch where the indicator briefly "jumps" backward before settling on the correct tab.This PR resets
offsetto0whenpageScrollStatebecomes"idle", ensuring that the final position is stable and that the indicator aligns correctly with the selected tab.Changes
offset.setValue(0);toonPageScrollStateChangedwhen state is'idle'Why
To prevent the tab indicator from jumping slightly backward after swiping, improving visual consistency. #12493
Notes
This fix has no functional side effects and only affects the visual animation when the swipe ends.
Tested on: