[RN + Reanimated 3] Drag-to-scroll causes unavoidable chop/jitter — block is child of ScrollView #9110
Replies: 1 comment 2 replies
-
|
Hey @Lovro31986! In general, it is hard to get scrolling perfectly synchronized with gesture-based position updates of the view. The correct approach is to react to the
Did you call
This can fix the jittering problem but won't fix the scrolling freeze issue caused by calling
Have you seen the react-native-sortables library? I wrote it some time ago as I struggled with similar issues as yours. Here is an example showing how to use the auto scroll feature. You can create a 1-column grid to achieve what you want. One think to keep in mind, this library doesn't support virtualization so if you render a few items, it is fine, but rendering tens or hundreds of items will hurt performance. You may also try a portal feature which may make the item movement smoother. Let me know if you have any questions. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a 24-hour vertical timeline where activity blocks are absolutely positioned inside an
Animated.ScrollView. When dragging a block to the screen edge, a JS-thread motor auto-scrolls the view while auseDerivedValuecompensates the block position to keep it under the finger.The result is persistent chop/jitter that gets worse the faster the scroll speed is. Multiple AI models have failed to fix this over many hours.
Current architecture:
The motor drives auto-scroll on the JS thread:
The block position is computed via
useDerivedValue:And applied via
useAnimatedStyle:Root cause (as best I understand it):
The block is a child of the ScrollView. When the native scroll moves, the OS repositions all children at the GPU level. The JS-thread motor then writes a compensating
topvalue — but these two updates hit the GPU at different times, causing a visible oscillation that gets worse at higher scroll speeds.What I've tried:
setInterval→ not frame-synchronized, causes phase driftrequestAnimationFrame→ same problemuseFrameCallbackwritingvirtualScrollY+useAnimatedReactioncallingscrollTo→ causes Android ANR or freeze+teleporttransform: translateYinstead oftopto cancel scroll movement → same chop, plus boundary issues at 00:00 and 24:00scrollYfrom scroll handler instead ofvirtualScrollY→ one frame behind, still chopsWhat I think the real fix requires:
Questions:
Versions: RN 0.73+, Reanimated 3.x, Gesture Handler 2.x, Android
Happy to share full code.
Beta Was this translation helpful? Give feedback.
All reactions