From e534ed9815ff8ced6b761a98a3f899bd170a5ac3 Mon Sep 17 00:00:00 2001 From: Chris Miles Date: Sat, 11 Oct 2025 16:06:19 -0400 Subject: [PATCH] Fix memory leak in AnimatedProps constructor Removes __attach() call from AnimatedProps constructor that caused duplicate child additions when combined with lifecycle hook. The constructor was calling __attach(), then useLayoutEffect in useAnimatedProps called it again on the same instance, causing each AnimatedProps to be added as a child twice to its parent nodes. This led to unbounded memory growth in applications with frequent re-renders. This change aligns with React Native core implementation, which does not call __attach() in the AnimatedProps constructor --- .../src/vendor/react-native/Animated/nodes/AnimatedProps.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/react-native-web/src/vendor/react-native/Animated/nodes/AnimatedProps.js b/packages/react-native-web/src/vendor/react-native/Animated/nodes/AnimatedProps.js index 7785530fd..132f977fa 100644 --- a/packages/react-native-web/src/vendor/react-native/Animated/nodes/AnimatedProps.js +++ b/packages/react-native-web/src/vendor/react-native/Animated/nodes/AnimatedProps.js @@ -32,7 +32,6 @@ class AnimatedProps extends AnimatedNode { } this._props = props; this._callback = callback; - this.__attach(); } __getValue(): Object {