Skip to content

[0.88] Preserve lazy ViewManager initialization in UIManager - #60553

Open
gabrieldonadel wants to merge 1 commit into
react:0.88-stablefrom
gabrieldonadel:@gabrieldonadel/0.88-pick-1532
Open

gabrieldonadel wants to merge 1 commit into
react:0.88-stablefrom
gabrieldonadel:@gabrieldonadel/0.88-pick-1532

Conversation

@gabrieldonadel

Copy link
Copy Markdown
Collaborator

Summary:

Backport of #58097 (da7c29f6d74) to 0.88-stable, for pick request reactwg/react-native-releases#1532.

UIManager spread UIManagerImpl into a new object. In Bridgeless mode UIManagerImpl can define enumerable lazy ViewManager getters, so the spread ran every getter during module initialization. The fix copies the property descriptors instead, so the getters stay lazy.

One conflict was resolved by hand. On main, measureLayout and measureLayoutRelativeToParent type errorCallback as (error: UnsafeObject) => void. 0.88-stable still has (error: Object) => void, and that type is kept. The UnsafeObject import that came with the pick is removed, since nothing uses it on this branch.

Changelog:

[GENERAL] [FIXED] - Preserve lazy ViewManager initialization in UIManager

Test Plan:

  • git cherry-pick -x keeps the original author.
  • yarn jest packages/react-native/Libraries/ReactNative/__tests__/UIManager-test.js: 1 suite, 1 test, passes.
  • eslint on UIManager.js and UIManager-test.js: no errors.
  • yarn flow check: no errors in the changed files.

Summary:
- Preserve lazy ViewManager property descriptors when composing UIManager.
- Avoid eagerly invoking lazy ViewManager getters and unnecessary getConstantsForViewManager calls during Bridgeless initialization.
- Add regression coverage for lazy, own, enumerable and one-time getter behavior.
- Platform scope: This targets the Android Bridgeless lazy ViewManager path. iOS does not currently expose this lazy getter path, so no iOS runtime behavior or performance change is expected.

[ANDROID] [FIXED] - Avoid unnecessary getConstantsForViewManager calls during UIManager initialization.

Pull Request resolved: react#58097

Test Plan:
- `yarn flow-check`
- `yarn test packages/react-native/Libraries/ReactNative --runInBand`
- `yarn lint --quiet`
- `yarn format-check`
- Verified with Android RNTester offlineDebug that startup no longer triggers eager getConstantsForViewManager calls.

Reviewed By: cipolleschi

Differential Revision: D124967747

Pulled By: javache

fbshipit-source-id: 1a4daf139b555ed266d5a7d3a0b90ebb02cfe5be
(cherry picked from commit da7c29f)
Signed-off-by: Gabriel Donadel <donadeldev@gmail.com>
@gabrieldonadel
gabrieldonadel force-pushed the @gabrieldonadel/0.88-pick-1532 branch from 6ada007 to ac1194a Compare December 5, 2026 14:39

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants