mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Fixing Fabric Interop layer bug defaulting to UnstableLegacyViewManagerAutomaticComponentDescriptor irrespective of feature flag (#50186)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/50186 When `useFabricInterop` is disabled, deleting component descriptors in Component Registry is failing since https://github.com/facebook/react-native/pull/47321 removed the Fabric Interop check from the ComponentDescriptorRegistry.cpp which was added earlier in https://github.com/facebook/react-native/pull/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. **Facebook:** Upon deleting component descriptors in [CatalystRegistry](https://www.internalfb.com/code/fbsource/fbandroid/java/com/facebook/fbreact/fabric/components/jni/CatalystRegistry.cpp) D71426627 & [TwilightRegistry](https://www.internalfb.com/code/fbsource/fbandroid/java/com/oculus/twilight/crossapp/reactpackage/fabric/components/jni/TwilightRegistry.cpp) D71206103 the apps weren't erroring or causing crash as expected even upon disabling `useFabricInterop` and this was because D65192744 removed the Fabric Interop check from the ComponentDescriptorRegistry.cpp which was added earlier in D52663244 Reviewed By: cipolleschi Differential Revision: D71582553 fbshipit-source-id: 0e87a789e5f0f8acba1958f74f9552dba1fe95c0
This commit is contained in:
1 parent
aef1f9ba1d
commit
529c24ad92
1 file changed
+16
-5
+16
-5
@@ -10,6 +10,7 @@
|
||||
#include "componentNameByReactViewName.h"
|
||||
|
||||
#include <react/debug/react_native_assert.h>
|
||||
#include <react/featureflags/ReactNativeFeatureFlags.h>
|
||||
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
||||
#include <react/renderer/components/legacyviewmanagerinterop/UnstableLegacyViewManagerAutomaticComponentDescriptor.h>
|
||||
#include <react/renderer/components/legacyviewmanagerinterop/UnstableLegacyViewManagerAutomaticShadowNode.h>
|
||||
@@ -83,11 +84,21 @@ const ComponentDescriptor& ComponentDescriptorRegistry::at(
|
||||
}
|
||||
|
||||
if (it == _registryByName.end()) {
|
||||
auto componentDescriptor = std::make_shared<
|
||||
const UnstableLegacyViewManagerAutomaticComponentDescriptor>(
|
||||
parameters_, unifiedComponentName);
|
||||
registerComponentDescriptor(componentDescriptor);
|
||||
return *_registryByName.find(unifiedComponentName)->second;
|
||||
if (ReactNativeFeatureFlags::useFabricInterop()) {
|
||||
auto componentDescriptor = std::make_shared<
|
||||
const UnstableLegacyViewManagerAutomaticComponentDescriptor>(
|
||||
parameters_, unifiedComponentName);
|
||||
registerComponentDescriptor(componentDescriptor);
|
||||
return *_registryByName.find(unifiedComponentName)->second;
|
||||
} else {
|
||||
if (_fallbackComponentDescriptor == nullptr) {
|
||||
throw std::invalid_argument(
|
||||
("Unable to find componentDescriptor for " + unifiedComponentName)
|
||||
.c_str());
|
||||
} else {
|
||||
return *_fallbackComponentDescriptor.get();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return *it->second;
|
||||
|
||||
Reference in new issue
Block a user