Skip to content

fix: glitching when reordering items#586

Merged
computerjazz merged 2 commits into
computerjazz:mainfrom
sunsama:hotfix/fix-glitching
May 5, 2025
Merged

fix: glitching when reordering items#586
computerjazz merged 2 commits into
computerjazz:mainfrom
sunsama:hotfix/fix-glitching

Conversation

@callaars

@callaars callaars commented Apr 23, 2025

Copy link
Copy Markdown
Contributor

Fix for issue: #572

This PR fixes an issue where drag state (activeKey, animated values) wasn’t correctly reset when the data prop changed. The previous implementation mutated activeKey directly during render without calling reset(), leaving shared animated values stale and potentially causing gesture bugs or UI inconsistencies. Having the reset() called too earlier made the UI glitch as it was rendering faster than the state change were processed.

We now defer the reset() call using InteractionManager.runAfterInteractions() to safely clear both React and Reanimated state after the render pass.

Why this matters:

  • Prevents visual glitches and inconsistent behaviour during/after drag
  • Ensures gesture state is fully reset between data updates
  • Avoids state mutation during render

@rohit9625

Copy link
Copy Markdown

Hi @computerjazz, could you please take a look at this one?

@bansara

bansara commented Apr 29, 2025

Copy link
Copy Markdown

+1

@akleiber

Copy link
Copy Markdown

I also experienced this and tried the fork. The fix is working very well. 🙏
Would be nice to have this merged.

@computerjazz

Copy link
Copy Markdown
Owner

thanks!

@Upsilon-Iridani

Copy link
Copy Markdown

This PR seems to be causing issues for me. I started using 4.0.3, and encountered issues matching the description in #572.

Using version 4.0.2 I see no such issues. I'm happy using 4.0.2 for now, just letting you know there's a potential regression here.

@callaars

Copy link
Copy Markdown
Contributor Author

Have you got new architecture turned on?

@Upsilon-Iridani

Copy link
Copy Markdown

Ah, not in that project, no.

outaTiME added a commit to outaTiME/react-native-draggable-flatlist that referenced this pull request Jul 3, 2025
thai99hanoi added a commit to thai99hanoi/react-native-draggable-flatlist that referenced this pull request Jul 3, 2025
Danswar pushed a commit to BtcTaroWallet/react-native-draggable-flatlist that referenced this pull request Apr 22, 2026
* fix: glitching when reordering items

* fix: don't change animation style as that causes glitches
callaars added a commit to sunsama/react-native-draggable-flatlist that referenced this pull request May 2, 2026
Track lib/ in this fork since it's consumed via git+SHA, and add
lib/ to .prettierignore so the pre-commit hook skips generated output.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants