diff --git a/React/Fabric/Mounting/ComponentViews/ActivityIndicator/RCTActivityIndicatorViewComponentView.mm b/React/Fabric/Mounting/ComponentViews/ActivityIndicator/RCTActivityIndicatorViewComponentView.mm index 257aaee235..ffa0203cbb 100644 --- a/React/Fabric/Mounting/ComponentViews/ActivityIndicator/RCTActivityIndicatorViewComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/ActivityIndicator/RCTActivityIndicatorViewComponentView.mm @@ -7,6 +7,7 @@ #import "RCTActivityIndicatorViewComponentView.h" +#import #import using namespace facebook::react; @@ -24,6 +25,13 @@ static UIActivityIndicatorViewStyle convertActivityIndicatorViewStyle(const Acti UIActivityIndicatorView *_activityIndicatorView; } +#pragma mark - RCTComponentViewProtocol + ++ (ComponentHandle)componentHandle +{ + return ActivityIndicatorViewShadowNode::Handle(); +} + - (instancetype)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { diff --git a/React/Fabric/Mounting/ComponentViews/Image/RCTImageComponentView.mm b/React/Fabric/Mounting/ComponentViews/Image/RCTImageComponentView.mm index 38d1dbb4f8..538ba8ed2f 100644 --- a/React/Fabric/Mounting/ComponentViews/Image/RCTImageComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/Image/RCTImageComponentView.mm @@ -10,6 +10,7 @@ #import #import #import +#import #import #import #import @@ -43,6 +44,11 @@ using namespace facebook::react; #pragma mark - RCTComponentViewProtocol ++ (ComponentHandle)componentHandle +{ + return ImageShadowNode::Handle(); +} + - (void)updateProps:(SharedProps)props oldProps:(SharedProps)oldProps { const auto &oldImageProps = *std::static_pointer_cast(oldProps ?: _props); diff --git a/React/Fabric/Mounting/ComponentViews/Root/RCTRootComponentView.mm b/React/Fabric/Mounting/ComponentViews/Root/RCTRootComponentView.mm index 4f1acc3722..d5e7b3be84 100644 --- a/React/Fabric/Mounting/ComponentViews/Root/RCTRootComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/Root/RCTRootComponentView.mm @@ -7,6 +7,7 @@ #import "RCTRootComponentView.h" +#import #import using namespace facebook::react; @@ -23,4 +24,9 @@ using namespace facebook::react; return self; } ++ (ComponentHandle)componentHandle +{ + return RootShadowNode::Handle(); +} + @end diff --git a/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm b/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm index fe62737728..f92ca42a80 100644 --- a/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm @@ -8,6 +8,7 @@ #import "RCTScrollViewComponentView.h" #import +#import #import #import #import @@ -48,7 +49,12 @@ using namespace facebook::react; return self; } -#pragma mark - ComponentViewProtocol +#pragma mark - RCTComponentViewProtocol + ++ (ComponentHandle)componentHandle +{ + return ScrollViewShadowNode::Handle(); +} - (void)updateProps:(SharedProps)props oldProps:(SharedProps)oldProps { diff --git a/React/Fabric/Mounting/ComponentViews/Switch/RCTSwitchComponentView.mm b/React/Fabric/Mounting/ComponentViews/Switch/RCTSwitchComponentView.mm index 5ff9be5e7c..91d5669968 100644 --- a/React/Fabric/Mounting/ComponentViews/Switch/RCTSwitchComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/Switch/RCTSwitchComponentView.mm @@ -9,6 +9,7 @@ #import #import +#import using namespace facebook::react; @@ -37,6 +38,13 @@ using namespace facebook::react; return self; } +#pragma mark - RCTComponentViewProtocol + ++ (ComponentHandle)componentHandle +{ + return SwitchShadowNode::Handle(); +} + - (void)updateProps:(SharedProps)props oldProps:(SharedProps)oldProps { const auto &oldSwitchProps = *std::static_pointer_cast(oldProps ?: _props); diff --git a/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm b/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm index 5d58241d6a..ab49dd466f 100644 --- a/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm @@ -9,6 +9,7 @@ #import #import +#import #import #import #import @@ -37,6 +38,13 @@ using namespace facebook::react; return self; } +#pragma mark - RCTComponentViewProtocol + ++ (ComponentHandle)componentHandle +{ + return ParagraphShadowNode::Handle(); +} + - (void)updateProps:(SharedProps)props oldProps:(SharedProps)oldProps { const auto ¶graphProps = std::static_pointer_cast(props); diff --git a/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm b/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm index ce7e4a2c14..7688d0d5f3 100644 --- a/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm @@ -7,6 +7,7 @@ #import "RCTViewComponentView.h" +#import #import #import #import @@ -78,6 +79,16 @@ using namespace facebook::react; _backgroundColor = backgroundColor; } +#pragma mark - RCTComponentViewProtocol + ++ (ComponentHandle)componentHandle +{ + RCTAssert( + self == [RCTViewComponentView class], + @"`+[RCTComponentViewProtocol componentHandle]` must be implemented for all subclasses (and `%@` particularly).", NSStringFromClass([self class])); + return ViewShadowNode::Handle(); +} + - (void)updateProps:(SharedProps)props oldProps:(SharedProps)oldProps { diff --git a/React/Fabric/Mounting/RCTComponentViewProtocol.h b/React/Fabric/Mounting/RCTComponentViewProtocol.h index b7a26571ec..5a5b7e3023 100644 --- a/React/Fabric/Mounting/RCTComponentViewProtocol.h +++ b/React/Fabric/Mounting/RCTComponentViewProtocol.h @@ -23,6 +23,12 @@ NS_ASSUME_NONNULL_BEGIN */ @protocol RCTComponentViewProtocol +/* + * Returns ComponentHandle of ComponentDescriptor which this ComponentView + * represents. + */ ++ (facebook::react::ComponentHandle)componentHandle; + /* * Called for mounting (attaching) a child component view inside `self` * component view.