Files
react-native/packages
Rubén Norte c97dcc2de5 Cache properties in global.nativeFabricUIManager when accessed through FabricUIManager.getFabricUIManager (#37796)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37796

Changelog: [internal]

`global.nativeFabricUIManager` is defined as a host object in https://github.com/facebook/react-native/blob/5cc8ceeae210f2f23ef18ded7b7b614682f0d67b/packages/react-native/ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp and every time a property of that object is accessed, the value is recreated by the host object (like in https://github.com/facebook/react-native/blob/5cc8ceeae210f2f23ef18ded7b7b614682f0d67b/packages/react-native/ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp#L179). This is problematic because we're continuously creating copies of those methods every time we access them.

As a quick solution (until we migrate the whole native implementation to a regular object with eagerly defined properties or to a TurboModule), this creates a proxy object in JavaScript to cache all properties.

Reviewed By: rshest

Differential Revision: D46592010

fbshipit-source-id: 38f233becd2ca130fa331d61f99ba54fbf706e13
2023-06-12 11:02:22 -07:00
..