From 1aeb9250bd817579ba8edc3bf2bb1217e22b24b9 Mon Sep 17 00:00:00 2001 From: Kevin Gozali Date: Tue, 13 Feb 2018 22:26:39 -0800 Subject: [PATCH] Add JS binding for FabricUIManager - iOS Reviewed By: sebmarkbage Differential Revision: D6934518 fbshipit-source-id: 1f626f79a74fb199925644e8b16238aa17d40e1f --- React/Fabric/RCTFabricUIManager.h | 31 +++++++++++++++-- React/Fabric/RCTFabricUIManager.mm | 56 +++++++++++++++++------------- 2 files changed, 61 insertions(+), 26 deletions(-) diff --git a/React/Fabric/RCTFabricUIManager.h b/React/Fabric/RCTFabricUIManager.h index 2228d1029..a1e5b5ed7 100644 --- a/React/Fabric/RCTFabricUIManager.h +++ b/React/Fabric/RCTFabricUIManager.h @@ -10,8 +10,35 @@ #import #import -#import +#import +#import -@interface RCTFabricUIManager : NSObject +@class RCTShadowView; + +/** + * The RCTFabricUIManager is the module responsible for updating the view hierarchy. + */ +@interface RCTFabricUIManager : NSObject + +- (RCTShadowView *)createNode:(nonnull NSNumber *)reactTag + viewName:(NSString *)viewName + rootTag:(nonnull NSNumber *)rootTag + props:(NSDictionary *)props + instanceHandle:(void *)instanceHandle; + +- (RCTShadowView *)cloneNode:(RCTShadowView *)node; +- (RCTShadowView *)cloneNodeWithNewChildren:(RCTShadowView *)node; +- (RCTShadowView *)cloneNodeWithNewProps:(RCTShadowView *)node + newProps:(NSDictionary *)props; +- (RCTShadowView *)cloneNodeWithNewChildrenAndProps:(RCTShadowView *)node + newProps:(NSDictionary *)props; +- (void)appendChild:(RCTShadowView *)parentNode + childNode:(RCTShadowView *)childNode; + +- (NSMutableArray *)createChildSet:(nonnull NSNumber *)rootTag; +- (void)appendChildToSet:(NSMutableArray *)childSet + childNode:(RCTShadowView *)childNode; +- (void)completeRoot:(nonnull NSNumber *)rootTag + childSet:(NSArray *)childSet; @end diff --git a/React/Fabric/RCTFabricUIManager.mm b/React/Fabric/RCTFabricUIManager.mm index e140aa60c..d8a754b06 100644 --- a/React/Fabric/RCTFabricUIManager.mm +++ b/React/Fabric/RCTFabricUIManager.mm @@ -12,55 +12,63 @@ // This file contains experimental placeholders, nothing is finalized. @implementation RCTFabricUIManager -@synthesize bridge = _bridge; - -RCT_EXPORT_MODULE() - -RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSNumber *, createNode:(int)reactTag - viewName:(NSString *)viewName - rootTag:(int)rootTag - props:(NSDictionary *)props - instanceHandle:(int)instanceHandleID) +- (void)dealloc { - return @0; } -RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSNumber *, cloneNode:(int)nodeID) +- (void)invalidate { - return @0; } -RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSNumber *, cloneNodeWithNewChildren:(int)nodeID) +- (RCTShadowView *)createNode:(nonnull NSNumber *)reactTag + viewName:(NSString *)viewName + rootTag:(nonnull NSNumber *)rootTag + props:(NSDictionary *)props + instanceHandle:(void *)instanceHandle { - return @0; + return nil; } -RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSNumber *, cloneNodeWithNewProps:(int)nodeID newProps:(NSDictionary *)newProps) +- (RCTShadowView *)cloneNode:(RCTShadowView *)node { - return @0; + return nil; +} +- (RCTShadowView *)cloneNodeWithNewChildren:(RCTShadowView *)node +{ + return nil; } -RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSNumber *, cloneNodeWithNewChildrenAndProps:(int)nodeID newProps:(NSDictionary *)newProps) +- (RCTShadowView *)cloneNodeWithNewProps:(RCTShadowView *)node + newProps:(NSDictionary *)props { - return @0; + return nil; } - -RCT_EXPORT_METHOD(appendChild:(int)parentNodeID child:(int)childNodeID) +- (RCTShadowView *)cloneNodeWithNewChildrenAndProps:(RCTShadowView *)node + newProps:(NSDictionary *)props +{ + return nil; +} +- (void)appendChild:(RCTShadowView *)parentNode + childNode:(RCTShadowView *)childNode { } -RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSNumber *, createChildSet) +- (NSMutableArray *)createChildSet:(nonnull NSNumber *)rootTag { - return @0; + return [NSMutableArray array]; } -RCT_EXPORT_METHOD(appendChildToSet:(int)childSetID child:(int)childNodeID) +- (void)appendChildToSet:(NSMutableArray *)childSet + childNode:(RCTShadowView *)childNode { + [childSet addObject:childNode]; } -RCT_EXPORT_METHOD(completeRoot:(int)rootTag childSet:(int)childSetID) +- (void)completeRoot:(nonnull NSNumber *)rootTag + childSet:(NSArray *)childSet { + } @end