Skip to content

Commit cc9dc61

Browse files
Fixing Fabric Interop layer bug defaulting to UnstableLegacyViewManagerAutomaticComponentDescriptor irrespective of feature flag (facebook#50441)
Summary: Pull Request resolved: facebook#50441 When useFabricInterop is disabled, deleting component descriptors in Component Registry is failing since facebook#47321 removed the Fabric Interop check from the ComponentDescriptorRegistry.cpp which was added earlier in facebook#42294 Adding back the logic of Fallback component descriptor and error for the same. Changelog: [General][Fixed] Fixing Fabric Interop layer bug defaulting to UnstableLegacyViewManagerAutomaticComponentDescriptor irrespective of feature flags. Reviewed By: javache Differential Revision: D72266017
1 parent 69a6c01 commit cc9dc61

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

packages/react-native/ReactCommon/react/renderer/componentregistry/ComponentDescriptorRegistry.cpp

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "componentNameByReactViewName.h"
1111

1212
#include <react/debug/react_native_assert.h>
13+
#include <react/featureflags/ReactNativeFeatureFlags.h>
1314
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
1415
#include <react/renderer/components/legacyviewmanagerinterop/UnstableLegacyViewManagerAutomaticComponentDescriptor.h>
1516
#include <react/renderer/components/legacyviewmanagerinterop/UnstableLegacyViewManagerAutomaticShadowNode.h>
@@ -83,11 +84,21 @@ const ComponentDescriptor& ComponentDescriptorRegistry::at(
8384
}
8485

8586
if (it == _registryByName.end()) {
86-
auto componentDescriptor = std::make_shared<
87-
const UnstableLegacyViewManagerAutomaticComponentDescriptor>(
88-
parameters_, unifiedComponentName);
89-
registerComponentDescriptor(componentDescriptor);
90-
return *_registryByName.find(unifiedComponentName)->second;
87+
if (ReactNativeFeatureFlags::useFabricInterop()) {
88+
auto componentDescriptor = std::make_shared<
89+
const UnstableLegacyViewManagerAutomaticComponentDescriptor>(
90+
parameters_, unifiedComponentName);
91+
registerComponentDescriptor(componentDescriptor);
92+
return *_registryByName.find(unifiedComponentName)->second;
93+
} else {
94+
if (_fallbackComponentDescriptor == nullptr) {
95+
throw std::invalid_argument(
96+
("Unable to find componentDescriptor for " + unifiedComponentName)
97+
.c_str());
98+
} else {
99+
return *_fallbackComponentDescriptor.get();
100+
}
101+
}
91102
}
92103

93104
return *it->second;

0 commit comments

Comments
 (0)