From e581977b51755a75852c704b155f74771548505f Mon Sep 17 00:00:00 2001 From: Valentin Shergin Date: Sun, 25 Nov 2018 22:15:00 -0800 Subject: [PATCH] Introducing RCTComponentViewFactory Summary: The whole mounting iOS infra now uses `ComponentHandle` instead of `std::string` as a reference to particular `ComponentView` implementation. All changes are pretty straightforward, we use a different thing/type to refer to the particular class; no changes in the logic besides a new `RCTComponentViewFactory` that serves the same role of classes registry as Objective-C runtime served previously. That has several benefits: * It should be slightly faster, mostly because we don't need to convert `char *` strings to `std::string` and then to `NSString *`. * We don't need string-based component-name maps anymore (at least on this layer). We can call classes as we want and it will work because of classes are now explicit about which ShadowNodes they are compatible with. * Most importantly, it's explicit now! That means that no runtime magic is involved anymore and we can rely on static linting tool now and not be afraid of improper code stripping/overoptimization. Reviewed By: mdvacca Differential Revision: D13130760 fbshipit-source-id: aadf70525a1335b96992443abae4da359efdc829 --- .../Mounting/MountItems/RCTCreateMountItem.h | 5 +- .../Mounting/MountItems/RCTCreateMountItem.mm | 12 ++-- .../Mounting/MountItems/RCTDeleteMountItem.h | 5 +- .../Mounting/MountItems/RCTDeleteMountItem.mm | 12 ++-- .../Fabric/Mounting/RCTComponentViewFactory.h | 37 +++++++++++ .../Mounting/RCTComponentViewFactory.mm | 65 +++++++++++++++++++ .../Mounting/RCTComponentViewRegistry.h | 18 +++-- .../Mounting/RCTComponentViewRegistry.mm | 54 +++++++-------- React/Fabric/Mounting/RCTMountingManager.h | 3 +- React/Fabric/Mounting/RCTMountingManager.mm | 14 ++-- React/Fabric/RCTScheduler.h | 2 +- React/Fabric/RCTScheduler.mm | 2 +- React/Fabric/RCTSurfacePresenter.h | 3 + React/Fabric/RCTSurfacePresenter.mm | 20 ++++-- 14 files changed, 186 insertions(+), 66 deletions(-) create mode 100644 React/Fabric/Mounting/RCTComponentViewFactory.h create mode 100644 React/Fabric/Mounting/RCTComponentViewFactory.mm diff --git a/React/Fabric/Mounting/MountItems/RCTCreateMountItem.h b/React/Fabric/Mounting/MountItems/RCTCreateMountItem.h index a969680443bae5..344fd1ab72b29e 100644 --- a/React/Fabric/Mounting/MountItems/RCTCreateMountItem.h +++ b/React/Fabric/Mounting/MountItems/RCTCreateMountItem.h @@ -7,6 +7,7 @@ #import +#import #import #import @@ -19,8 +20,8 @@ NS_ASSUME_NONNULL_BEGIN */ @interface RCTCreateMountItem : NSObject -- (instancetype)initWithComponentName:(NSString *)componentName - tag:(ReactTag)tag; +- (instancetype)initWithComponentHandle:(facebook::react::ComponentHandle)componentHandle + tag:(ReactTag)tag; @end diff --git a/React/Fabric/Mounting/MountItems/RCTCreateMountItem.mm b/React/Fabric/Mounting/MountItems/RCTCreateMountItem.mm index e51642952740db..a91f0194c1a89f 100644 --- a/React/Fabric/Mounting/MountItems/RCTCreateMountItem.mm +++ b/React/Fabric/Mounting/MountItems/RCTCreateMountItem.mm @@ -9,16 +9,18 @@ #import "RCTComponentViewRegistry.h" +using namespace facebook::react; + @implementation RCTCreateMountItem { - NSString *_componentName; + ComponentHandle _componentHandle; ReactTag _tag; } -- (instancetype)initWithComponentName:(NSString *)componentName - tag:(ReactTag)tag +- (instancetype)initWithComponentHandle:(facebook::react::ComponentHandle)componentHandle + tag:(ReactTag)tag { if (self = [super init]) { - _componentName = componentName; + _componentHandle = componentHandle; _tag = tag; } @@ -27,7 +29,7 @@ - (instancetype)initWithComponentName:(NSString *)componentName - (void)executeWithRegistry:(RCTComponentViewRegistry *)registry { - [registry dequeueComponentViewWithName:_componentName tag:_tag]; + [registry dequeueComponentViewWithComponentHandle:_componentHandle tag:_tag]; } @end diff --git a/React/Fabric/Mounting/MountItems/RCTDeleteMountItem.h b/React/Fabric/Mounting/MountItems/RCTDeleteMountItem.h index 1907023e17fc32..f0d07b47c90021 100644 --- a/React/Fabric/Mounting/MountItems/RCTDeleteMountItem.h +++ b/React/Fabric/Mounting/MountItems/RCTDeleteMountItem.h @@ -7,6 +7,7 @@ #import +#import #import #import @@ -17,8 +18,8 @@ NS_ASSUME_NONNULL_BEGIN */ @interface RCTDeleteMountItem : NSObject -- (instancetype)initWithComponentName:(NSString *)componentName - tag:(ReactTag)tag; +- (instancetype)initWithComponentHandle:(facebook::react::ComponentHandle)componentHandle + tag:(ReactTag)tag; @end diff --git a/React/Fabric/Mounting/MountItems/RCTDeleteMountItem.mm b/React/Fabric/Mounting/MountItems/RCTDeleteMountItem.mm index c45fba6172c984..9528d60cae1aab 100644 --- a/React/Fabric/Mounting/MountItems/RCTDeleteMountItem.mm +++ b/React/Fabric/Mounting/MountItems/RCTDeleteMountItem.mm @@ -9,16 +9,18 @@ #import "RCTComponentViewRegistry.h" +using namespace facebook::react; + @implementation RCTDeleteMountItem { - NSString *_componentName; + ComponentHandle _componentHandle; ReactTag _tag; } -- (instancetype)initWithComponentName:(NSString *)componentName - tag:(ReactTag)tag +- (instancetype)initWithComponentHandle:(facebook::react::ComponentHandle)componentHandle + tag:(ReactTag)tag { if (self = [super init]) { - _componentName = componentName; + _componentHandle = componentHandle; _tag = tag; } @@ -33,7 +35,7 @@ - (void)executeWithRegistry:(RCTComponentViewRegistry *)registry return; } - [registry enqueueComponentViewWithName:_componentName tag:_tag componentView:componentView]; + [registry enqueueComponentViewWithComponentHandle:_componentHandle tag:_tag componentView:componentView]; } @end diff --git a/React/Fabric/Mounting/RCTComponentViewFactory.h b/React/Fabric/Mounting/RCTComponentViewFactory.h new file mode 100644 index 00000000000000..1aed476a1adf5e --- /dev/null +++ b/React/Fabric/Mounting/RCTComponentViewFactory.h @@ -0,0 +1,37 @@ +/** + * 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 + +#import + +NS_ASSUME_NONNULL_BEGIN + +/** + * Registry of supported component view classes that can instantiate + * view component instances by given component handle. + */ +@interface RCTComponentViewFactory : NSObject + +/** + * Constructs and returns an instance of the class with a bunch of already registered standard components. + */ ++ (RCTComponentViewFactory *)standardComponentViewFactory; + +/** + * Registers a component view class in the factory. + */ +- (void)registerComponentViewClass:(Class)componentViewClass; + +/** + * Creates a component view with given component handle. + */ +- (UIView *)createComponentViewWithComponentHandle:(facebook::react::ComponentHandle)componentHandle; + +@end + +NS_ASSUME_NONNULL_END diff --git a/React/Fabric/Mounting/RCTComponentViewFactory.mm b/React/Fabric/Mounting/RCTComponentViewFactory.mm new file mode 100644 index 00000000000000..817f65657fc9c9 --- /dev/null +++ b/React/Fabric/Mounting/RCTComponentViewFactory.mm @@ -0,0 +1,65 @@ +/** + * 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 "RCTComponentViewFactory.h" + +#import +#import + +#import "RCTViewComponentView.h" +#import "RCTImageComponentView.h" +#import "RCTScrollViewComponentView.h" +#import "RCTParagraphComponentView.h" +#import "RCTRootComponentView.h" +#import "RCTActivityIndicatorViewComponentView.h" +#import "RCTSwitchComponentView.h" + +using namespace facebook::react; + +@implementation RCTComponentViewFactory +{ + std::unordered_map> _registry; +} + ++ (RCTComponentViewFactory *)standardComponentViewFactory +{ + RCTAssertMainQueue(); + + RCTComponentViewFactory *componentViewFactory = [[RCTComponentViewFactory alloc] init]; + + [componentViewFactory registerComponentViewClass:[RCTViewComponentView class]]; + [componentViewFactory registerComponentViewClass:[RCTRootComponentView class]]; + [componentViewFactory registerComponentViewClass:[RCTScrollViewComponentView class]]; + [componentViewFactory registerComponentViewClass:[RCTImageComponentView class]]; + [componentViewFactory registerComponentViewClass:[RCTParagraphComponentView class]]; + [componentViewFactory registerComponentViewClass:[RCTActivityIndicatorViewComponentView class]]; + [componentViewFactory registerComponentViewClass:[RCTSwitchComponentView class]]; + + return componentViewFactory; +} + +- (void)registerComponentViewClass:(Class)componentViewClass +{ + RCTAssertMainQueue(); + + ComponentHandle componentHandle = [componentViewClass componentHandle]; + _registry[componentHandle] = componentViewClass; +} + +- (UIView *)createComponentViewWithComponentHandle:(facebook::react::ComponentHandle)componentHandle +{ + RCTAssertMainQueue(); + + auto iterator = _registry.find(componentHandle); + RCTAssert( + iterator != _registry.end(), + @"ComponentView with componentHandle `%lli` (`%s`) not found.", componentHandle, (char *)componentHandle); + Class componentViewClass = iterator->second; + return [[componentViewClass alloc] init]; +} + +@end diff --git a/React/Fabric/Mounting/RCTComponentViewRegistry.h b/React/Fabric/Mounting/RCTComponentViewRegistry.h index ba32ec648808e7..127c1e5c7e1905 100644 --- a/React/Fabric/Mounting/RCTComponentViewRegistry.h +++ b/React/Fabric/Mounting/RCTComponentViewRegistry.h @@ -7,6 +7,8 @@ #import +#import +#import #import NS_ASSUME_NONNULL_BEGIN @@ -17,21 +19,23 @@ NS_ASSUME_NONNULL_BEGIN */ @interface RCTComponentViewRegistry : NSObject +@property (nonatomic, strong, readonly) RCTComponentViewFactory *componentViewFactory; + /** * Returns a native view instance from the recycle pool (or create) - * for given `componentName` and with given `tag`. + * for given `componentHandle` and with given `tag`. * #RefuseSingleUse */ -- (UIView *)dequeueComponentViewWithName:(NSString *)componentName - tag:(ReactTag)tag; +- (UIView *)dequeueComponentViewWithComponentHandle:(facebook::react::ComponentHandle)componentHandle + tag:(ReactTag)tag; /** * Puts a given native component view to the recycle pool. * #RefuseSingleUse */ -- (void)enqueueComponentViewWithName:(NSString *)componentName - tag:(ReactTag)tag - componentView:(UIView *)componentView; +- (void)enqueueComponentViewWithComponentHandle:(facebook::react::ComponentHandle)componentHandle + tag:(ReactTag)tag + componentView:(UIView *)componentView; /** * Returns a native component view by given `tag`. @@ -46,7 +50,7 @@ NS_ASSUME_NONNULL_BEGIN /** * Creates a component view with a given type and puts it to the recycle pool. */ -- (void)preliminaryCreateComponentViewWithName:(NSString *)componentName; +- (void)optimisticallyCreateComponentViewWithComponentHandle:(facebook::react::ComponentHandle)componentHandle; @end diff --git a/React/Fabric/Mounting/RCTComponentViewRegistry.mm b/React/Fabric/Mounting/RCTComponentViewRegistry.mm index f6374a27f9ef59..c5e1563901d0d2 100644 --- a/React/Fabric/Mounting/RCTComponentViewRegistry.mm +++ b/React/Fabric/Mounting/RCTComponentViewRegistry.mm @@ -10,6 +10,8 @@ #import #import +using namespace facebook::react; + #define LEGACY_UIMANAGER_INTEGRATION_ENABLED 1 #ifdef LEGACY_UIMANAGER_INTEGRATION_ENABLED @@ -67,8 +69,8 @@ + (void)unregisterView:(UIView *)view const NSInteger RCTComponentViewRegistryRecyclePoolMaxSize = 1024; @implementation RCTComponentViewRegistry { - NSMapTable *> *_registry; - NSMapTable *> *> *_recyclePool; + NSMapTable *> *_registry; + NSMapTable *> *> *_recyclePool; } - (instancetype)init @@ -76,15 +78,16 @@ - (instancetype)init if (self = [super init]) { _registry = [NSMapTable mapTableWithKeyOptions:NSPointerFunctionsIntegerPersonality | NSPointerFunctionsOpaqueMemory valueOptions:NSPointerFunctionsObjectPersonality]; - _recyclePool = [NSMapTable mapTableWithKeyOptions:NSPointerFunctionsObjectPersonality + _recyclePool = [NSMapTable mapTableWithKeyOptions:NSPointerFunctionsOpaquePersonality | NSPointerFunctionsOpaqueMemory valueOptions:NSPointerFunctionsObjectPersonality]; + _componentViewFactory = [RCTComponentViewFactory standardComponentViewFactory]; } return self; } -- (UIView *)dequeueComponentViewWithName:(NSString *)componentName - tag:(ReactTag)tag +- (UIView *)dequeueComponentViewWithComponentHandle:(ComponentHandle)componentHandle + tag:(ReactTag)tag { RCTAssertMainQueue(); @@ -92,7 +95,7 @@ - (instancetype)init @"RCTComponentViewRegistry: Attempt to dequeue already registered component."); UIView *componentView = - [self _dequeueComponentViewWithName:componentName]; + [self _dequeueComponentViewWithComponentHandle:componentHandle]; componentView.tag = tag; [_registry setObject:componentView forKey:(__bridge id)(void *)tag]; @@ -103,9 +106,9 @@ - (instancetype)init return componentView; } -- (void)enqueueComponentViewWithName:(NSString *)componentName - tag:(ReactTag)tag - componentView:(UIView *)componentView +- (void)enqueueComponentViewWithComponentHandle:(ComponentHandle)componentHandle + tag:(ReactTag)tag + componentView:(UIView *)componentView { RCTAssertMainQueue(); @@ -118,14 +121,14 @@ - (void)enqueueComponentViewWithName:(NSString *)componentName [_registry removeObjectForKey:(__bridge id)(void *)tag]; componentView.tag = 0; - [self _enqueueComponentViewWithName:componentName componentView:componentView]; + [self _enqueueComponentViewWithComponentHandle:componentHandle componentView:componentView]; } -- (void)preliminaryCreateComponentViewWithName:(NSString *)componentName +- (void)optimisticallyCreateComponentViewWithComponentHandle:(ComponentHandle)componentHandle { RCTAssertMainQueue(); - [self _enqueueComponentViewWithName:componentName - componentView:[self _createComponentViewWithName:componentName]]; + [self _enqueueComponentViewWithComponentHandle:componentHandle + componentView:[self.componentViewFactory createComponentViewWithComponentHandle:componentHandle]]; } - (UIView *)componentViewByTag:(ReactTag)tag @@ -140,21 +143,13 @@ - (ReactTag)tagByComponentView:(UIView *)componentView return componentView.tag; } -- (UIView *)_createComponentViewWithName:(NSString *)componentName -{ - RCTAssertMainQueue(); - // This is temporary approach. - NSString *className = [NSString stringWithFormat:@"RCT%@ComponentView", componentName]; - UIView *componentView = [[NSClassFromString(className) alloc] init]; - return componentView; -} - -- (nullable UIView *)_dequeueComponentViewWithName:(NSString *)componentName +- (nullable UIView *)_dequeueComponentViewWithComponentHandle:(ComponentHandle)componentHandle { RCTAssertMainQueue(); - NSHashTable *> *componentViews = [_recyclePool objectForKey:componentName]; + NSHashTable *> *componentViews = + [_recyclePool objectForKey:(__bridge id)(void *)componentHandle]; if (!componentViews || componentViews.count == 0) { - return [self _createComponentViewWithName:componentName]; + return [self.componentViewFactory createComponentViewWithComponentHandle:componentHandle]; } UIView *componentView = [componentViews anyObject]; @@ -162,16 +157,17 @@ - (ReactTag)tagByComponentView:(UIView *)componentView return componentView; } -- (void)_enqueueComponentViewWithName:(NSString *)componentName - componentView:(UIView *)componentView +- (void)_enqueueComponentViewWithComponentHandle:(ComponentHandle)componentHandle + componentView:(UIView *)componentView { RCTAssertMainQueue(); [componentView prepareForRecycle]; - NSHashTable *> *componentViews = [_recyclePool objectForKey:componentName]; + NSHashTable *> *componentViews = + [_recyclePool objectForKey:(__bridge id)(void *)componentHandle]; if (!componentViews) { componentViews = [NSHashTable hashTableWithOptions:NSPointerFunctionsObjectPersonality]; - [_recyclePool setObject:componentViews forKey:componentName]; + [_recyclePool setObject:componentViews forKey:(__bridge id)(void *)componentHandle]; } if (componentViews.count >= RCTComponentViewRegistryRecyclePoolMaxSize) { diff --git a/React/Fabric/Mounting/RCTMountingManager.h b/React/Fabric/Mounting/RCTMountingManager.h index 600d33c86b6b2b..68ed226d0da352 100644 --- a/React/Fabric/Mounting/RCTMountingManager.h +++ b/React/Fabric/Mounting/RCTMountingManager.h @@ -7,6 +7,7 @@ #import +#import #import #import #import @@ -37,7 +38,7 @@ NS_ASSUME_NONNULL_BEGIN * The receiver is free to ignore the request. * Can be called from any thread. */ -- (void)preliminaryCreateComponentViewWithName:(NSString *)componentName; +- (void)optimisticallyCreateComponentViewWithComponentHandle:(facebook::react::ComponentHandle)componentHandle; @end diff --git a/React/Fabric/Mounting/RCTMountingManager.mm b/React/Fabric/Mounting/RCTMountingManager.mm index c018d0fbb0d77e..3b7a1a23b31e27 100644 --- a/React/Fabric/Mounting/RCTMountingManager.mm +++ b/React/Fabric/Mounting/RCTMountingManager.mm @@ -47,19 +47,17 @@ - (void)performTransactionWithMutations:(facebook::react::ShadowViewMutationList for (const auto &mutation : mutations) { switch (mutation.type) { case ShadowViewMutation::Create: { - NSString *componentName = RCTNSStringFromString(mutation.newChildShadowView.componentName, NSASCIIStringEncoding); RCTCreateMountItem *mountItem = - [[RCTCreateMountItem alloc] initWithComponentName:componentName - tag:mutation.newChildShadowView.tag]; + [[RCTCreateMountItem alloc] initWithComponentHandle:mutation.newChildShadowView.componentHandle + tag:mutation.newChildShadowView.tag]; [mountItems addObject:mountItem]; break; } case ShadowViewMutation::Delete: { - NSString *componentName = RCTNSStringFromString(mutation.oldChildShadowView.componentName, NSASCIIStringEncoding); RCTDeleteMountItem *mountItem = - [[RCTDeleteMountItem alloc] initWithComponentName:componentName - tag:mutation.oldChildShadowView.tag]; + [[RCTDeleteMountItem alloc] initWithComponentHandle:mutation.oldChildShadowView.componentHandle + tag:mutation.oldChildShadowView.tag]; [mountItems addObject:mountItem]; break; } @@ -170,10 +168,10 @@ - (void)_performMountItems:(NSArray *)mountItems [self.delegate mountingManager:self didMountComponentsWithRootTag:rootTag]; } -- (void)preliminaryCreateComponentViewWithName:(NSString *)componentName +- (void)optimisticallyCreateComponentViewWithComponentHandle:(ComponentHandle)componentHandle { RCTExecuteOnMainQueue(^{ - [self->_componentViewRegistry preliminaryCreateComponentViewWithName:componentName]; + [self->_componentViewRegistry optimisticallyCreateComponentViewWithComponentHandle:componentHandle]; }); } diff --git a/React/Fabric/RCTScheduler.h b/React/Fabric/RCTScheduler.h index 9a80af8ec59cd4..ff3baa318e79fc 100644 --- a/React/Fabric/RCTScheduler.h +++ b/React/Fabric/RCTScheduler.h @@ -25,7 +25,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)schedulerDidFinishTransaction:(facebook::react::ShadowViewMutationList)mutations rootTag:(ReactTag)rootTag; -- (void)schedulerDidRequestPreliminaryViewAllocationWithComponentName:(NSString *)componentName; +- (void)schedulerOptimisticallyCreateComponentViewWithComponentHandle:(facebook::react::ComponentHandle)componentHandle; @end diff --git a/React/Fabric/RCTScheduler.mm b/React/Fabric/RCTScheduler.mm index 7c65f1c6fc1f92..8276a68c9e0bfb 100644 --- a/React/Fabric/RCTScheduler.mm +++ b/React/Fabric/RCTScheduler.mm @@ -29,7 +29,7 @@ void schedulerDidFinishTransaction(Tag rootTag, const ShadowViewMutationList &mu void schedulerDidRequestPreliminaryViewAllocation(SurfaceId surfaceId, ComponentName componentName, bool isLayoutable, ComponentHandle componentHandle) override { RCTScheduler *scheduler = (__bridge RCTScheduler *)scheduler_; - [scheduler.delegate schedulerDidRequestPreliminaryViewAllocationWithComponentName:RCTNSStringFromString(componentName, NSASCIIStringEncoding)]; + [scheduler.delegate schedulerOptimisticallyCreateComponentViewWithComponentHandle:componentHandle]; } private: diff --git a/React/Fabric/RCTSurfacePresenter.h b/React/Fabric/RCTSurfacePresenter.h index d95c57bc15a98d..c3eeacd32578de 100644 --- a/React/Fabric/RCTSurfacePresenter.h +++ b/React/Fabric/RCTSurfacePresenter.h @@ -9,6 +9,7 @@ #import #import +#import #import NS_ASSUME_NONNULL_BEGIN @@ -26,6 +27,8 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)initWithBridge:(RCTBridge *)bridge; +@property (nonatomic, readonly) RCTComponentViewFactory *componentViewFactory; + @end @interface RCTSurfacePresenter (Surface) diff --git a/React/Fabric/RCTSurfacePresenter.mm b/React/Fabric/RCTSurfacePresenter.mm index 1b8a92110e386e..1ad7a3464888f2 100644 --- a/React/Fabric/RCTSurfacePresenter.mm +++ b/React/Fabric/RCTSurfacePresenter.mm @@ -26,6 +26,7 @@ #import #import #import +#import #import #import @@ -80,6 +81,11 @@ - (void)dealloc [[NSNotificationCenter defaultCenter] removeObserver:self]; } +- (RCTComponentViewFactory *)componentViewFactory +{ + return _mountingManager.componentViewRegistry.componentViewFactory; +} + #pragma mark - Internal Surface-dedicated Interface - (void)registerSurface:(RCTFabricSurface *)surface @@ -188,7 +194,8 @@ - (RCTScheduler *)_scheduler - (void)_startSurface:(RCTFabricSurface *)surface { - [_mountingManager.componentViewRegistry dequeueComponentViewWithName:@"Root" tag:surface.rootTag]; + [_mountingManager.componentViewRegistry dequeueComponentViewWithComponentHandle:RootShadowNode::Handle() + tag:surface.rootTag]; LayoutContext layoutContext = { .pointScaleFactor = RCTScreenScale() @@ -210,8 +217,11 @@ - (void)_stopSurface:(RCTFabricSurface *)surface { [self._scheduler stopSurfaceWithSurfaceId:surface.rootTag]; - UIView *rootView = [_mountingManager.componentViewRegistry componentViewByTag:surface.rootTag]; - [_mountingManager.componentViewRegistry enqueueComponentViewWithName:@"Root" tag:surface.rootTag componentView:rootView]; + UIView *rootView = + [_mountingManager.componentViewRegistry componentViewByTag:surface.rootTag]; + [_mountingManager.componentViewRegistry enqueueComponentViewWithComponentHandle:RootShadowNode::Handle() + tag:surface.rootTag + componentView:rootView]; [surface _unsetStage:(RCTSurfaceStagePrepared | RCTSurfaceStageMounted)]; } @@ -243,9 +253,9 @@ - (void)schedulerDidFinishTransaction:(facebook::react::ShadowViewMutationList)m rootTag:rootTag]; } -- (void)schedulerDidRequestPreliminaryViewAllocationWithComponentName:(NSString *)componentName +- (void)schedulerOptimisticallyCreateComponentViewWithComponentHandle:(ComponentHandle)componentHandle { - [_mountingManager preliminaryCreateComponentViewWithName:componentName]; + [_mountingManager optimisticallyCreateComponentViewWithComponentHandle:componentHandle]; } #pragma mark - RCTMountingManagerDelegate