Lay groundwork for Fabric iOS plugins

Summary: Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D18397243

fbshipit-source-id: bae51800e93259e50db51dac2d9d7b4b52d8ef23
This commit is contained in:
Samuel Susla
2019-11-18 06:57:23 -08:00
committed by Facebook Github Bot
parent 75a154b449
commit d1f0826f2c
3 changed files with 22 additions and 3 deletions
@@ -14,6 +14,16 @@
NS_ASSUME_NONNULL_BEGIN
@protocol RCTComponentViewFactoryDelegate <NSObject>
/**
* Given a component name, return its actual class. If component with doesn't exist, nil is returned.
* Can be called on any thread.
*/
- (Class<RCTComponentViewProtocol>)componentViewClassWithName:(facebook::react::ComponentName)name;
@end
/**
* Registry of supported component view classes that can instantiate
* view component instances by given component handle.
@@ -42,6 +52,8 @@ NS_ASSUME_NONNULL_BEGIN
- (facebook::react::ComponentDescriptorRegistry::Shared)createComponentDescriptorRegistryWithParameters:
(facebook::react::ComponentDescriptorParameters)parameters;
@property (atomic, weak, nullable) id<RCTComponentViewFactoryDelegate> delegate;
@end
NS_ASSUME_NONNULL_END
@@ -66,8 +66,15 @@ using namespace facebook::react;
providerRegistry->setComponentDescriptorProviderRequest([providerRegistry,
componentViewFactory](ComponentName requestedComponentName) {
// Fallback 1: Call the delegate.
// To be implemented.
// Fallback 1: Call delegate for component view class.
if (componentViewFactory.delegate) {
Class<RCTComponentViewProtocol> klass =
[componentViewFactory.delegate componentViewClassWithName:requestedComponentName];
if (klass) {
[componentViewFactory registerComponentViewClass:klass];
return;
}
}
// Fallback 2: Try to use Paper Interop.
if ([RCTLegacyViewManagerInteropComponentView isSupported:RCTNSStringFromString(requestedComponentName)]) {
+1 -1
View File
@@ -10,6 +10,7 @@
#import <React/RCTPrimitives.h>
#import <React/RCTSurfacePresenterStub.h>
#import <React/RCTComponentViewFactory.h>
#import <react/utils/ContextContainer.h>
#import <react/utils/RuntimeExecutor.h>
@@ -18,7 +19,6 @@ NS_ASSUME_NONNULL_BEGIN
@class RCTFabricSurface;
@class RCTImageLoader;
@class RCTMountingManager;
@class RCTComponentViewFactory;
/**
* Coordinates presenting of React Native Surfaces and represents application