mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Animated JS: clear out component refs on unmount
Summary: "The instance should not stick around after unmount..." - Tim Yung, 2021 I have a hypothesis that, if a component instance of an animated component sticks around after unmount, it could cause memory leaks due to references to Fabric ShadowNodes across the JSI (this would not impact non-Fabric... in theory). Wild guess. If OOMs disappear then maybe this hypothesis is correct, but it's a long shot. I figure there's ~no harm in doing this cleanup here anyway. Changelog: [Internal] Reviewed By: sammy-SC Differential Revision: D26650348 fbshipit-source-id: 90633db650b65755cacfb52344e7b53e46c9b125
This commit is contained in:
committed by
Facebook GitHub Bot
parent
3e06af9394
commit
468bc62da3
@@ -299,6 +299,8 @@ function createAnimatedComponent<Props: {+[string]: mixed, ...}, Instance>(
|
||||
this._propsAnimated && this._propsAnimated.__detach();
|
||||
this._detachNativeEvents();
|
||||
this._markUpdateComplete();
|
||||
this._component = null;
|
||||
this._prevComponent = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user