From 8c231b7d811774fc227f5bc853aff256471d89fc Mon Sep 17 00:00:00 2001 From: David Vacca Date: Fri, 2 May 2025 12:22:32 -0700 Subject: [PATCH] Document logic implemented in ComponentDescriptorRegistry when a component is not found (#51062) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/51062 Document logic implemented in ComponentDescriptorRegistry when a component is not found changelog: [internal] internal Reviewed By: arushikesarwani94, cortinico Differential Revision: D74036572 fbshipit-source-id: 20a5d182e0308538cdfa3f5e97957d488f010f0d --- .../componentregistry/ComponentDescriptorRegistry.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/react-native/ReactCommon/react/renderer/componentregistry/ComponentDescriptorRegistry.cpp b/packages/react-native/ReactCommon/react/renderer/componentregistry/ComponentDescriptorRegistry.cpp index e8b4616f62e..469fc5c2335 100644 --- a/packages/react-native/ReactCommon/react/renderer/componentregistry/ComponentDescriptorRegistry.cpp +++ b/packages/react-native/ReactCommon/react/renderer/componentregistry/ComponentDescriptorRegistry.cpp @@ -85,12 +85,21 @@ const ComponentDescriptor& ComponentDescriptorRegistry::at( if (it == _registryByName.end()) { if (ReactNativeFeatureFlags::useFabricInterop()) { + // When interop is enabled, if the component is not found we rely on + // UnstableLegacyViewManagerAutomaticComponentDescriptor to support legacy + // components in new architecture. auto componentDescriptor = std::make_shared< const UnstableLegacyViewManagerAutomaticComponentDescriptor>( parameters_, unifiedComponentName); registerComponentDescriptor(componentDescriptor); return *_registryByName.find(unifiedComponentName)->second; } else { + // When interop is disabled, if the component is not found we rely on + // fallbackComponentDescriptor (default: + // UnimplementedNativeViewComponentDescriptor). + // UnimplementedNativeViewComponentDescriptor displays a View in debug + // mode to alert the developer that the component is not properly + // configured, and an empty view in release mode. if (_fallbackComponentDescriptor == nullptr) { throw std::invalid_argument( ("Unable to find componentDescriptor for " + unifiedComponentName)