Fabric: Introducing -[RCTComponentViewProtocol componentHandle]

Summary: The new method in the protocol enforces view component classes to expose a component handle of the component that the view component represents. That will allow us to wire up those classes with shadow views in runtime explicitly and in a much more performant way than it is now.

Reviewed By: mdvacca

Differential Revision: D13114663

fbshipit-source-id: 853187d978aab200f85719d9c1d9fea2e3ad4e55
This commit is contained in:
Valentin Shergin
2018-11-25 22:14:59 -08:00
committed by Facebook Github Bot
parent 89f647d521
commit eef3df86fb
8 changed files with 60 additions and 1 deletions

View File

@@ -9,6 +9,7 @@
#import <react/components/switch/SwitchEventEmitter.h>
#import <react/components/switch/SwitchProps.h>
#import <react/components/switch/SwitchShadowNode.h>
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<const SwitchProps>(oldProps ?: _props);