diff --git a/Libraries/ART/ARTGroup.m b/Libraries/ART/ARTGroup.m index 692d03035bcfcb..8315a39678cd26 100644 --- a/Libraries/ART/ARTGroup.m +++ b/Libraries/ART/ARTGroup.m @@ -11,13 +11,19 @@ @implementation ARTGroup - (void)renderLayerTo:(CGContextRef)context { - if (!CGRectIsEmpty(self.clipping)) { CGContextClipToRect(context, self.clipping); } - for (ARTNode *node in self.subviews) { - [node renderTo:context]; + for (UIView *subview in self.subviews) { + if ([subview respondsToSelector:@selector(renderTo:)]) { + [(ARTNode *)subview renderTo:context]; + } else { + // This is needed for legacy interop layer. Legacy interop layer + // is superview of the view that it is bridging, that's why we need + // to grab its first subview. + [(ARTNode *)subview.subviews.firstObject renderTo:context]; + } } } diff --git a/Libraries/ART/ARTNode.m b/Libraries/ART/ARTNode.m index 8cd3c551b9484b..dc6e46a9bad5ad 100644 --- a/Libraries/ART/ARTNode.m +++ b/Libraries/ART/ARTNode.m @@ -43,8 +43,10 @@ - (void)setTransform:(CGAffineTransform)transform - (void)invalidate { - id container = (id)self.superview; - [container invalidate]; + if ([self.superview respondsToSelector:@selector(invalidate)]) { + id container = (id)self.superview; + [container invalidate]; + } } - (void)renderTo:(CGContextRef)context diff --git a/Libraries/ART/ARTSurfaceView.m b/Libraries/ART/ARTSurfaceView.m index 99cb1275933345..22503910bec60f 100644 --- a/Libraries/ART/ARTSurfaceView.m +++ b/Libraries/ART/ARTSurfaceView.m @@ -49,8 +49,15 @@ - (void)drawRect:(CGRect)rect { [super drawRect:rect]; CGContextRef context = UIGraphicsGetCurrentContext(); - for (ARTNode *node in self.subviews) { - [node renderTo:context]; + for (UIView *subview in self.subviews) { + if ([subview respondsToSelector:@selector(renderTo:)]) { + [(ARTNode *)subview renderTo:context]; + } else { + // This is needed for legacy interop layer. Legacy interop layer + // is superview of the view that it is bridging, that's why we need + // to grab its first subview. + [(ARTNode *)subview.subviews.firstObject renderTo:context]; + } } } diff --git a/React/Fabric/Mounting/ComponentViews/ART/RCTARTSurfaceShadowNode.cpp b/React/Fabric/Mounting/ComponentViews/ART/RCTARTSurfaceShadowNode.cpp deleted file mode 100644 index cbb3c1998abae5..00000000000000 --- a/React/Fabric/Mounting/ComponentViews/ART/RCTARTSurfaceShadowNode.cpp +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -namespace facebook { -namespace react { - -extern const char RCTARTSurfaceViewComponentName[] = "ARTSurfaceView"; - -} // namespace react -} // namespace facebook diff --git a/React/Fabric/Mounting/ComponentViews/ART/RCTARTSurfaceShadowNode.h b/React/Fabric/Mounting/ComponentViews/ART/RCTARTSurfaceShadowNode.h deleted file mode 100644 index 3a26257acc5f7a..00000000000000 --- a/React/Fabric/Mounting/ComponentViews/ART/RCTARTSurfaceShadowNode.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include "RCTARTSurfaceViewProps.h" - -namespace facebook { -namespace react { - -extern const char RCTARTSurfaceViewComponentName[]; - -/* - * `ShadowNode` for component. - */ -using RCTARTSurfaceShadowNode = ConcreteViewShadowNode< - RCTARTSurfaceViewComponentName, - RCTARTSurfaceViewProps, - ViewEventEmitter>; - -} // namespace react -} // namespace facebook diff --git a/React/Fabric/Mounting/ComponentViews/ART/RCTARTSurfaceViewComponentDescriptor.h b/React/Fabric/Mounting/ComponentViews/ART/RCTARTSurfaceViewComponentDescriptor.h deleted file mode 100644 index 4cd2480ad5050a..00000000000000 --- a/React/Fabric/Mounting/ComponentViews/ART/RCTARTSurfaceViewComponentDescriptor.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include "RCTARTSurfaceShadowNode.h" - -namespace facebook { -namespace react { - -using RCTARTSurfaceComponentDescriptor = - ConcreteComponentDescriptor; - -} // namespace react -} // namespace facebook diff --git a/React/Fabric/Mounting/ComponentViews/ART/RCTARTSurfaceViewComponentView.h b/React/Fabric/Mounting/ComponentViews/ART/RCTARTSurfaceViewComponentView.h deleted file mode 100644 index 30a6ab992fa7b8..00000000000000 --- a/React/Fabric/Mounting/ComponentViews/ART/RCTARTSurfaceViewComponentView.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -/** - * UIView class for root component. - */ -@interface RCTARTSurfaceViewComponentView : RCTViewComponentView - -@end diff --git a/React/Fabric/Mounting/ComponentViews/ART/RCTARTSurfaceViewComponentView.mm b/React/Fabric/Mounting/ComponentViews/ART/RCTARTSurfaceViewComponentView.mm deleted file mode 100644 index f8a26d871f6bf8..00000000000000 --- a/React/Fabric/Mounting/ComponentViews/ART/RCTARTSurfaceViewComponentView.mm +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTARTSurfaceViewComponentView.h" -#import -#import "RCTARTSurfaceViewComponentDescriptor.h" - -#import "FBRCTFabricComponentsPlugins.h" - -using namespace facebook::react; - -@implementation RCTARTSurfaceViewComponentView { -} - -- (instancetype)initWithFrame:(CGRect)frame -{ - if (self = [super initWithFrame:frame]) { - static const auto defaultProps = std::make_shared(); - _props = defaultProps; - } - - return self; -} - -#pragma mark - RCTComponentViewProtocol - -+ (ComponentDescriptorProvider)componentDescriptorProvider -{ - return concreteComponentDescriptorProvider(); -} - -@end - -Class RCTARTSurfaceViewCls(void) -{ - return RCTARTSurfaceViewComponentView.class; -} diff --git a/React/Fabric/Mounting/ComponentViews/ART/RCTARTSurfaceViewProps.cpp b/React/Fabric/Mounting/ComponentViews/ART/RCTARTSurfaceViewProps.cpp deleted file mode 100644 index fd94a7c0d8f73d..00000000000000 --- a/React/Fabric/Mounting/ComponentViews/ART/RCTARTSurfaceViewProps.cpp +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "RCTARTSurfaceViewProps.h" - -#include - -namespace facebook { -namespace react { - -RCTARTSurfaceViewProps::RCTARTSurfaceViewProps( - const RCTARTSurfaceViewProps &sourceProps, - const RawProps &rawProps) - : ViewProps(sourceProps, rawProps) {} - -} // namespace react -} // namespace facebook diff --git a/React/Fabric/Mounting/ComponentViews/ART/RCTARTSurfaceViewProps.h b/React/Fabric/Mounting/ComponentViews/ART/RCTARTSurfaceViewProps.h deleted file mode 100644 index cbebf7c4de82d5..00000000000000 --- a/React/Fabric/Mounting/ComponentViews/ART/RCTARTSurfaceViewProps.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include - -namespace facebook { -namespace react { - -class RCTARTSurfaceViewProps final : public ViewProps { - public: - RCTARTSurfaceViewProps() = default; - RCTARTSurfaceViewProps( - const RCTARTSurfaceViewProps &sourceProps, - const RawProps &rawProps); - -#pragma mark - Props -}; - -} // namespace react -} // namespace facebook diff --git a/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm b/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm index fc689ca35c324e..9da0483fad089a 100644 --- a/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm @@ -36,8 +36,16 @@ - (instancetype)initWithFrame:(CGRect)frame + (NSMutableSet *)supportedViewManagers { - static NSMutableSet *supported = - [NSMutableSet setWithObjects:@"Picker", @"DatePicker", @"ProgressView", @"SegmentedControl", @"MaskedView", nil]; + static NSMutableSet *supported = [NSMutableSet setWithObjects:@"Picker", + @"DatePicker", + @"ProgressView", + @"SegmentedControl", + @"MaskedView", + @"ARTSurfaceView", + @"ARTText", + @"ARTShape", + @"ARTGroup", + nil]; return supported; } diff --git a/React/Fabric/Mounting/ComponentViews/RCTFabricComponentsPlugins.h b/React/Fabric/Mounting/ComponentViews/RCTFabricComponentsPlugins.h index 3bf14b7394b3c7..60f9dca7efafd3 100644 --- a/React/Fabric/Mounting/ComponentViews/RCTFabricComponentsPlugins.h +++ b/React/Fabric/Mounting/ComponentViews/RCTFabricComponentsPlugins.h @@ -37,7 +37,6 @@ Class RCTSliderCls(void) __attribute__((used)); Class RCTSwitchCls(void) __attribute__((used)); Class RCTUnimplementedNativeViewCls(void) __attribute__((used)); Class RCTModalHostViewCls(void) __attribute__((used)); -Class RCTARTSurfaceViewCls(void) __attribute__((used)); Class RCTImageCls(void) __attribute__((used)); #ifdef __cplusplus diff --git a/React/Fabric/Mounting/ComponentViews/RCTFabricComponentsPlugins.mm b/React/Fabric/Mounting/ComponentViews/RCTFabricComponentsPlugins.mm index ccb07bcbb8e28a..f56ec907d8467a 100644 --- a/React/Fabric/Mounting/ComponentViews/RCTFabricComponentsPlugins.mm +++ b/React/Fabric/Mounting/ComponentViews/RCTFabricComponentsPlugins.mm @@ -26,7 +26,6 @@ {"Switch", RCTSwitchCls}, {"UnimplementedNativeView", RCTUnimplementedNativeViewCls}, {"ModalHostView", RCTModalHostViewCls}, - {"ARTSurfaceView", RCTARTSurfaceViewCls}, {"Image", RCTImageCls}, }; diff --git a/ReactCommon/fabric/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.mm b/ReactCommon/fabric/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.mm index dec8a569783662..7e2c3813676cf0 100644 --- a/ReactCommon/fabric/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.mm +++ b/ReactCommon/fabric/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.mm @@ -29,6 +29,12 @@ // If `moduleName` has "FB" prefix. return componentName + "Manager"; } + + std::string artPrefix("ART"); + if (std::mismatch(artPrefix.begin(), artPrefix.end(), componentName.begin()).first == artPrefix.end()) { + return componentName + "Manager"; + } + return "RCT" + componentName + "Manager"; }