mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
00eab3d6fb
Summary: ComponentDescriptorProvider represents unified way to create a particular descriptor. Now all ComponentViews (which support RCTComponentViewProtocol) expose a `ComponentDescriptorProvider` which will allow creating and registering ComponentDescriptor instances for all visual components automatically as a part of ComponentView registration process. Don't panic, everything is still being as explicit as it always was, no magic involved; we just will have only one registration step instead of two parallel. That also opens a way to register components on the fly. Reviewed By: JoshuaGross Differential Revision: D14963488 fbshipit-source-id: 9e9d9166fabaf7b30b35b8647faa6e3a19cd2435
35 lines
796 B
Plaintext
35 lines
796 B
Plaintext
/**
|
|
* 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 "RCTRootComponentView.h"
|
|
|
|
#import <react/components/root/RootComponentDescriptor.h>
|
|
#import <react/components/root/RootProps.h>
|
|
|
|
using namespace facebook::react;
|
|
|
|
@implementation RCTRootComponentView
|
|
|
|
- (instancetype)initWithFrame:(CGRect)frame
|
|
{
|
|
if (self = [super initWithFrame:frame]) {
|
|
static const auto defaultProps = std::make_shared<const RootProps>();
|
|
_props = defaultProps;
|
|
}
|
|
|
|
return self;
|
|
}
|
|
|
|
#pragma mark - RCTComponentViewProtocol
|
|
|
|
+ (ComponentDescriptorProvider)componentDescriptorProvider
|
|
{
|
|
return concreteComponentDescriptorProvider<RootComponentDescriptor>();
|
|
}
|
|
|
|
@end
|