Skip to content

Commit

Permalink
Minor: Move RCTLogNewArchitectureValidation in RCTLegacyViewManagerIn…
Browse files Browse the repository at this point in the history
…teropComponentView

Summary: Changelog: [Internal][iOS]

Reviewed By: fkgozali

Differential Revision: D37733640

fbshipit-source-id: cb447ceba2a43fdd9808c80c54af99ff4d31305b
  • Loading branch information
p-sun authored and facebook-github-bot committed Jul 9, 2022
1 parent 5e23ed6 commit b834d58
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,6 @@ - (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector

+ (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];
Expand Down
11 changes: 10 additions & 1 deletion React/Fabric/Mounting/RCTComponentViewFactory.mm
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,16 @@ - (BOOL)registerComponentIfPossible:(std::string const &)name
}

// 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);
Expand Down

0 comments on commit b834d58

Please sign in to comment.