Skip to content

Skip static view config verification without native view configs - #60361

Merged
meta-codesync[bot] merged 1 commit into
react:mainfrom
expo:@ide/skip-unavailable-view-config-verification
Dec 4, 2026
Merged

meta-codesync[bot] merged 1 commit into
react:mainfrom
expo:@ide/skip-unavailable-view-config-verification

Conversation

@ide

@ide ide commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary:

A bridgeless host can turn on static view config verification with NativeComponentRegistry.setRuntimeConfigProvider(() => ({native: false, verify: true})). If the host has no legacy view config interop binding, each native component then logs a console.error the first time it is used:

[ReactNative Architecture][JS] 'getViewManagerConfig('RCTView')' is not available in the new React Native architecture. If 'RCTView' has a ViewManager and you want to retrieve its native ViewConfig, please turn on the native ViewConfig interop layer. ...

In bridgeless mode, UIManager.getViewManagerConfig reads native view configs from the binding global.RN$LegacyInterop_UIManager_getConstants. Without it, the call logs the error above and returns null, so verification does nothing. The binding is absent when:

  • useNativeViewConfigsInBridgelessMode is off. It is off in ReactNativeFeatureFlagsDefaults; the stock entry points turn it on (RCTReactNativeFactory on iOS, ReactNativeNewArchitectureFeatureFlagsDefaults on Android), so this affects hosts that set up feature flags another way.
  • An iOS app is built with RCT_REMOVE_LEGACY_COMPONENT_INTEROP, which compiles the binding out (RCTInstance.mm). RNTester, which turns verification on in bridgeless development builds, logs these errors only in that case.

NativeComponentRegistry.get now skips verification when the binding is absent. Nothing was verified in that case, so the only change is that the errors stop.

getWithFallback_DEPRECATED, with no runtime config provider set, checks that a component exists with getViewManagerConfig(name) != null, which without the binding logs the error and returns the fallback for a component that exists. It now calls hasViewManagerConfig(name): the same null check on the old architecture, and a query of the native component registry in bridgeless mode. That query throws if global.__nativeComponentRegistry__hasComponent is missing (NativeComponentRegistryUnstable.js), so the change reaches every bridgeless host; every host here installs it before running JavaScript (RCTInstance.mm, ComponentNameResolverBinding on Android, ReactHost.cpp in ReactCxxPlatform); development builds already call hasViewManagerConfig when AppContainer-dev.js loads DebuggingOverlay.js.

Changelog:

[GENERAL] [FIXED] - Stop logging a getViewManagerConfig error for every component when static view config verification is on in bridgeless mode, and stop getWithFallback_DEPRECATED from returning the fallback for a registered component there

Test Plan:

yarn jest --runInBand packages/react-native/Libraries/NativeComponent/__tests__/NativeComponentRegistry-test.js

NativeComponentRegistry-test.js is new. With NativeComponentRegistry.js from main, the case for bridgeless mode without the binding fails (verification requests the native view config), and so does the getWithFallback_DEPRECATED case (it returns the fallback for a registered component). Replacing either half of the new condition (global.RN$Bridgeless === true, or the check for global.RN$LegacyInterop_UIManager_getConstants) with true fails the case that covers it. The tests set or remove the binding themselves.

yarn jest --runInBand packages/react-native/Libraries/NativeComponent packages/react-native/Libraries/ReactNative packages/react-native/Libraries/Utilities/__tests__/codegenNativeComponent-test.js

These pass, as do Flow, ESLint and Prettier. Not run: an app without the binding.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 28, 2026
@github-actions github-actions Bot added the Meta Review Required This PR is considered risky and requires Meta to import it to do more testing before merging. label Nov 29, 2026

@chrfalch chrfalch left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commenting rather than approving since this is still a draft.

One question: getWithFallback_DEPRECATED now calls hasViewManagerConfig, which in bridgeless mode goes through unstable_hasComponent (NativeComponentRegistryUnstable.js). That throws if global.__nativeComponentRegistry__hasComponent isn't registered, where the old path returned null. Since this applies to every bridgeless host without a runtime config provider, it's wider than the verification change the PR describes. Can you confirm the global is always installed in bridgeless mode (and ideally point to where), or guard the call so a missing binding still falls back to null?

@ide

ide commented Nov 29, 2026

Copy link
Copy Markdown
Contributor Author

Every bridgeless host in this repository installs it before running JavaScript:

  • iOS: RCTInstance.mm calls RCTInstallNativeComponentRegistryBinding unconditionally in initializeRuntime.
  • Android: ReactInstance.kt installs ComponentNameResolverBinding, whose install calls bindHasComponentProvider.
  • ReactCxxPlatform (Fantom): ReactHost.cpp calls bindHasComponentProvider.

Development builds already depend on it: AppContainer-dev.js imports DebuggingOverlay.js, which calls UIManager.hasViewManagerConfig('DebuggingOverlay') when it loads, so a bridgeless host without the global fails at startup today. I added this to the description.

@ide
ide force-pushed the @ide/skip-unavailable-view-config-verification branch from 4064e8d to 5e3c6b6 Compare November 29, 2026 12:01
@ide
ide marked this pull request as ready for review November 29, 2026 13:49
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Nov 29, 2026

@chrfalch chrfalch left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update, LGTM.

global.RN$Bridgeless === true &&
global.RN$LegacyInterop_UIManager_getConstants == null
) {
return viewConfig;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a warnOnce in development? verify was enabled but legacy interop is disabled.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, added a dev-only warnOnce in f416ed4 when verify is enabled without the legacy view config interop binding, along with unit tests covering dev and non-dev behavior.

A bridgeless host that sets `setRuntimeConfigProvider(() => ({native: false, verify: true}))` and has no legacy view config interop binding logs a `console.error` the first time each native component is used:

  [ReactNative Architecture][JS] 'getViewManagerConfig('RCTView')' is not available in the new React Native architecture. ...

Verification compares a component's static view config with its native one. In bridgeless mode, `UIManager.getViewManagerConfig` reads native view configs from `global.RN$LegacyInterop_UIManager_getConstants`. Native installs that binding only when `useNativeViewConfigsInBridgelessMode` is on, and an iOS build with `RCT_REMOVE_LEGACY_COMPONENT_INTEROP` never installs it. Without the binding, the call logs the error and returns null for every component, and verification then does nothing.

The flag is off in `ReactNativeFeatureFlagsDefaults`. The stock entry points turn it on (`RCTReactNativeFactory` on iOS, the new architecture defaults on Android), so RNTester as shipped is affected only when it is built with `RCT_REMOVE_LEGACY_COMPONENT_INTEROP`.

`NativeComponentRegistry.get` now skips verification when the binding is absent, logging a single `warnOnce` warning in development instead of a per-component error.

`getWithFallback_DEPRECATED` reaches the same error another way. With no runtime config provider set, it checks that a component exists with `getViewManagerConfig(name) != null`, which logs the error and returns the fallback for a component that exists. It now calls `hasViewManagerConfig(name)`, which is the same null check on the old architecture and asks the native component registry in bridgeless mode. That query throws if `global.__nativeComponentRegistry__hasComponent` is missing; every bridgeless host installs it before running JavaScript.

Signed-off-by: James Ide <ide@expo.dev>
@ide
ide force-pushed the @ide/skip-unavailable-view-config-verification branch from 5e3c6b6 to f416ed4 Compare December 3, 2026 13:35
@meta-codesync

meta-codesync Bot commented Dec 3, 2026

Copy link
Copy Markdown

@javache has imported this pull request. If you are a Meta employee, you can view this in D135948468.

@christophpurrer christophpurrer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review automatically exported from Phabricator review in Meta.

@meta-codesync
meta-codesync Bot merged commit 1db1ee7 into react:main Dec 4, 2026
105 of 106 checks passed
@react-native-bot

Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @ide in 1db1ee7

When will my fix make it into a release? | How to file a pick request?

@react-native-bot react-native-bot added the Merged This PR has been merged. label Dec 4, 2026
@ide
ide deleted the @ide/skip-unavailable-view-config-verification branch December 4, 2026 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Meta Review Required This PR is considered risky and requires Meta to import it to do more testing before merging. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants