Repository navigation
[0.87] Preserve lazy ViewManager initialization in UIManager - #59812
brunohmagro wants to merge 1 commit into
Conversation
Backport da7c29f (react#58097), originally contributed by fairysword, to 0.87-stable. Keep the existing Object callback annotations when resolving the upstream typing conflicts. Preserve the original descriptor composition and regression test without adding behavior changes.
|
Hi @brunohmagro! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Summary:
Backport the lazy ViewManager initialization fix from #58097 (commit da7c29f) to 0.87-stable. The original fix by @fairysword has already landed on
main; this PR only adapts it to the supported release branch.UIManager.jsspreadsUIManagerImpl, which eagerly evaluates its enumerable lazy ViewManager getters. On Android in Bridgeless mode, importing the module can therefore synchronously callgetConstantsForViewManagerfor registered lazy ViewManagers before their configurations are needed. Copying property descriptors preserves lazy initialization and the existing measurement/command overrides.The upstream commit does not apply cleanly to
0.87-stable: its callback-typing hunks expect untypederrorCallbackparameters, whereas 0.87 already annotates them with(error: Object) => void. This backport retains those existing annotations and omits the now-unnecessaryUnsafeObjectimport. The descriptor-composition fix and regression test are copied from upstream, without additional behavior changes.This is submitted against the stable branch because of that cherry-pick conflict, as permitted by the release pick process. The fix is absent from
0.87-stableat 2a41d8c. No dependency changes or public API changes are included.Release pick request: reactwg/react-native-releases#1503
Changelog:
[ANDROID] [FIXED] - Avoid unnecessary getConstantsForViewManager calls during UIManager initialization.
Test Plan:
Executed locally on the 0.87 stable checkout using Node 22.14.0 and Yarn 1.22.22:
yarn install --frozen-lockfile --non-interactiveyarn test packages/react-native/Libraries/ReactNative/__tests__/UIManager-test.js --runInBandfails as expected:getConstantsForViewManageris called once during import, where zero calls are expected.yarn test packages/react-native/Libraries/ReactNative --runInBandpasses (2 suites, 4 tests). The test verifies no eager call, an own/enumerable property, and one configuration call across repeated accesses.yarn test --maxWorkers=4passes: 219 suites, 5,662 tests, 1,658 snapshots; 1 test skipped. Jest also reports a worker teardown warning after the passing suites and exits with code 0.yarn flow-check --max-workers 4passes with 0 errors.yarn lint --quietpasses.yarn format-checkpasses.yarn build-types --validatepasses; the public API snapshot is unchanged.git diff --checkpasses.No fresh Android/iOS native build or device performance benchmark was run for this backport. This PR makes no quantified startup-time claim; native/device validation reported in the original PR remains attributed to that PR's contributors.