Skip to content

Conversation

@callaars
Copy link
Contributor

@callaars callaars commented Apr 23, 2025

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

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

@bansara
Copy link

bansara commented Apr 29, 2025

+1

@akleiber
Copy link

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

@computerjazz
Copy link
Owner

thanks!

@Upsilon-Iridani
Copy link

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
Contributor Author

Have you got new architecture turned on?

@Upsilon-Iridani
Copy link

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
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