Closed blackazaru closed 6 months ago
Probably the same issue as described in #535
Also experiencing this issue!
Creating a patch with the changes @nmassey created here: https://github.com/dohooo/react-native-reanimated-carousel/pull/574 fixed this bug for me on ^4.0.0-alpha.10
I'm experiencing this in alpha.6 and above, for me it look like alpha.5 doesn't exhibit this.
Describe the bug Page rendering is incorrect when changing the scrolling direction
To Reproduce Steps to reproduce the behavior:
Expected behavior You should see the previous element, but the carousel renders the same one.
Screenshots
https://github.com/dohooo/react-native-reanimated-carousel/assets/6501334/6394f9f0-3c23-44db-ba73-eeb3c548eed9
Versions (please complete the following information):
Smartphone (please complete the following information):
Additional context
My review indicates that Reanimated's useSharedValue doesn't update the value immediately (scrollEndTranslation). https://github.com/dohooo/react-native-reanimated-carousel/blob/d78784808f1a4d233708561354ca198122cfbb62/src/components/ScrollViewGesture.tsx#L342-L355
Consequently, we encounter an incorrect (previous) value in the endWithSpring function, which triggers the incorrect direction. https://github.com/dohooo/react-native-reanimated-carousel/blob/d78784808f1a4d233708561354ca198122cfbb62/src/components/ScrollViewGesture.tsx#L138-L142