Minor: Move RCTLogNewArchitectureValidation in RCTLegacyViewManagerInteropComponentView

Summary: Changelog: [Internal][iOS]

Reviewed By: fkgozali

Differential Revision: D37733640

fbshipit-source-id: cb447ceba2a43fdd9808c80c54af99ff4d31305b
This commit is contained in:
Paige Sun
2022-07-08 19:27:05 -07:00
committed by Facebook GitHub Bot
parent 5e23ed699f
commit b834d5869f
2 changed files with 10 additions and 9 deletions
@@ -109,14 +109,6 @@ static NSString *const kRCTLegacyInteropChildIndexKey = @"index";
+ (BOOL)isSupported:(NSString *)componentName
{
RCTLogNewArchitectureValidation(
RCTNotAllowedInBridgeless,
self,
[NSString
stringWithFormat:
@"Legacy ViewManagers should be migrated to Fabric ComponentViews in the new architecture to reduce risk. Component using interop layer: %@",
componentName]);
// Step 1: check if ViewManager with specified name is supported.
BOOL isComponentNameSupported =
[[RCTLegacyViewManagerInteropComponentView supportedViewManagers] containsObject:componentName];
@@ -117,7 +117,16 @@ static Class<RCTComponentViewProtocol> RCTComponentViewClassWithName(const char
}
// Fallback 2: Try to use Paper Interop.
if ([RCTLegacyViewManagerInteropComponentView isSupported:RCTNSStringFromString(name)]) {
NSString *componentNameString = RCTNSStringFromString(name);
if ([RCTLegacyViewManagerInteropComponentView isSupported:componentNameString]) {
RCTLogNewArchitectureValidation(
RCTNotAllowedInBridgeless,
self,
[NSString
stringWithFormat:
@"Legacy ViewManagers should be migrated to Fabric ComponentViews in the new architecture to reduce risk. Component using interop layer: %@",
componentNameString]);
auto flavor = std::make_shared<std::string const>(name);
auto componentName = ComponentName{flavor->c_str()};
auto componentHandle = reinterpret_cast<ComponentHandle>(componentName);