UNPKG

1.85 kBtext/x-cView Raw
1/*
2 * Copyright (c) Facebook, Inc. and its affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8#import <UIKit/UIKit.h>
9
10#import <React/RCTComponentViewDescriptor.h>
11#import <React/RCTComponentViewProtocol.h>
12
13#import <react/uimanager/ComponentDescriptorRegistry.h>
14
15NS_ASSUME_NONNULL_BEGIN
16
17@protocol RCTComponentViewFactoryDelegate <NSObject>
18
19/**
20 * Given a component name, return its actual class. If component with doesn't exist, nil is returned.
21 * Can be called on any thread.
22 */
23- (Class<RCTComponentViewProtocol>)componentViewClassWithName:(facebook::react::ComponentName)name;
24
25@end
26
27/**
28 * Registry of supported component view classes that can instantiate
29 * view component instances by given component handle.
30 */
31@interface RCTComponentViewFactory : NSObject
32
33/**
34 * Constructs and returns an instance of the class with a bunch of already registered standard components.
35 */
36+ (RCTComponentViewFactory *)standardComponentViewFactory;
37
38/**
39 * Registers a component view class in the factory.
40 */
41- (void)registerComponentViewClass:(Class<RCTComponentViewProtocol>)componentViewClass;
42
43/**
44 * Creates a component view with given component handle.
45 */
46- (RCTComponentViewDescriptor)createComponentViewWithComponentHandle:(facebook::react::ComponentHandle)componentHandle;
47
48/**
49 * Creates *managed* `ComponentDescriptorRegistry`. After creation, the object continues to store a weak pointer to the
50 * registry and update it accordingly to the changes in the object.
51 */
52- (facebook::react::ComponentDescriptorRegistry::Shared)createComponentDescriptorRegistryWithParameters:
53 (facebook::react::ComponentDescriptorParameters)parameters;
54
55@property (atomic, weak, nullable) id<RCTComponentViewFactoryDelegate> delegate;
56
57@end
58
59NS_ASSUME_NONNULL_END