From b834d5869fdb5df61cd4a8db77ea64ed4cd3f3f4 Mon Sep 17 00:00:00 2001 From: Paige Sun Date: Fri, 8 Jul 2022 19:27:05 -0700 Subject: [PATCH] Minor: Move RCTLogNewArchitectureValidation in RCTLegacyViewManagerInteropComponentView Summary: Changelog: [Internal][iOS] Reviewed By: fkgozali Differential Revision: D37733640 fbshipit-source-id: cb447ceba2a43fdd9808c80c54af99ff4d31305b --- .../RCTLegacyViewManagerInteropComponentView.mm | 8 -------- React/Fabric/Mounting/RCTComponentViewFactory.mm | 11 ++++++++++- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm b/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm index b8cffa13138..5324963ea01 100644 --- a/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm @@ -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]; diff --git a/React/Fabric/Mounting/RCTComponentViewFactory.mm b/React/Fabric/Mounting/RCTComponentViewFactory.mm index 1487beaa2a9..c2ba53bf29a 100644 --- a/React/Fabric/Mounting/RCTComponentViewFactory.mm +++ b/React/Fabric/Mounting/RCTComponentViewFactory.mm @@ -117,7 +117,16 @@ static Class 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(name); auto componentName = ComponentName{flavor->c_str()}; auto componentHandle = reinterpret_cast(componentName);