Skip to content

Conversation

@staszekscp
Copy link
Contributor

Summary

While working with @react-navigation package I noticed a leak that was leaving multiple Detached <div> instances in the memory while using Animated API on web. They were never garbage collected.

After a week-long investigation I finally found the root cause for the problem. It turned out that _animatedView instance was never set to null, even after detaching the element. It turned out that this problem has already been solved in the react-native repository. But since react-native-web uses an older version of React Native it was not reflected in the vendor directory.

My suggestion is to cherry-pick this solution also to some other versions of react-native-web (to v19 and v20), since I noticed it there, too.

@codesandbox-ci
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit b8d3c9e:

Sandbox Source
react-native-web-examples Configuration

@necolas
Copy link
Owner

necolas commented Aug 20, 2025

Yeah patching this is a good idea. I don't know of a good way to keep Animated up to date given the effort to make the RN Animated available as an installable package has stalled.

@necolas
Copy link
Owner

necolas commented Aug 20, 2025

Out in 0.21.1

@staszekscp
Copy link
Contributor Author

Thanks for the quick reaction!

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.

2 participants