diff --git a/React/Fabric/RCTFabricUIManager.h b/React/Fabric/RCTFabricUIManager.h deleted file mode 100644 index 371ac19ba69..00000000000 --- a/React/Fabric/RCTFabricUIManager.h +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import -#import - -@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 - -@interface RCTBridge (RCTFabricUIManager) - -@property (nonatomic, readonly) RCTFabricUIManager *fabricUIManager; - -@end diff --git a/React/Fabric/RCTFabricUIManager.mm b/React/Fabric/RCTFabricUIManager.mm deleted file mode 100644 index 71d2198b8eb..00000000000 --- a/React/Fabric/RCTFabricUIManager.mm +++ /dev/null @@ -1,86 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTFabricUIManager.h" - -// This file contains experimental placeholders, nothing is finalized. -@implementation RCTFabricUIManager - -- (void)dealloc -{ -} - -- (void)invalidate -{ -} - -- (RCTShadowView *)createNode:(nonnull NSNumber *)reactTag - viewName:(NSString *)viewName - rootTag:(nonnull NSNumber *)rootTag - props:(NSDictionary *)props - instanceHandle:(void *)instanceHandle -{ - return nil; -} - -- (RCTShadowView *)cloneNode:(RCTShadowView *)node -{ - return nil; -} -- (RCTShadowView *)cloneNodeWithNewChildren:(RCTShadowView *)node -{ - return nil; -} - -- (RCTShadowView *)cloneNodeWithNewProps:(RCTShadowView *)node - newProps:(NSDictionary *)props -{ - return nil; -} -- (RCTShadowView *)cloneNodeWithNewChildrenAndProps:(RCTShadowView *)node - newProps:(NSDictionary *)props -{ - return nil; -} -- (void)appendChild:(RCTShadowView *)parentNode - childNode:(RCTShadowView *)childNode -{ - -} - -- (NSMutableArray *)createChildSet:(nonnull NSNumber *)rootTag -{ - return [NSMutableArray array]; -} - -- (void)appendChildToSet:(NSMutableArray *)childSet - childNode:(RCTShadowView *)childNode -{ - if (!childNode) { - // TODO: until this class is fully implemented, we may get nil from JS. - return; - } - - [childSet addObject:childNode]; -} - -- (void)completeRoot:(nonnull NSNumber *)rootTag - childSet:(NSArray *)childSet -{ - -} - -@end - -@implementation RCTBridge (RCTFabricUIManager) - -- (RCTFabricUIManager *)fabricUIManager -{ - return [self jsBoundExtraModuleForClass:[RCTFabricUIManager class]]; -} - -@end diff --git a/React/Fabric/RCTFabricUIManagerWrapper.h b/React/Fabric/RCTFabricUIManagerWrapper.h new file mode 100644 index 00000000000..1db660fcf38 --- /dev/null +++ b/React/Fabric/RCTFabricUIManagerWrapper.h @@ -0,0 +1,45 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import + +#import + +#import +#import +#import + +namespace facebook { +namespace react { + +class FabricUIManager; + +} +} + +using namespace facebook::react; + +/** + * An ObjC++ wrapper around the C++ FabricUIManager instance, so that the RCTCxxBridge can access it as needed. + */ +@interface RCTFabricUIManagerWrapper : NSObject + +- (instancetype)initWithManager:(std::shared_ptr)manager; +- (std::shared_ptr)manager; + +@end + +@interface RCTBridge (RCTFabricUIManagerWrapper) + +/** + * To access via the bridge: + * + * std::shared_ptr fabricUIManager = [_bridge fabricUIManager]; + */ +- (std::shared_ptr)fabricUIManager; + +@end diff --git a/React/Fabric/RCTFabricUIManagerWrapper.mm b/React/Fabric/RCTFabricUIManagerWrapper.mm new file mode 100644 index 00000000000..e1fc129d8a7 --- /dev/null +++ b/React/Fabric/RCTFabricUIManagerWrapper.mm @@ -0,0 +1,49 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import "RCTFabricUIManagerWrapper.h" + +#include + +// This file contains experimental placeholders, nothing is finalized. +@implementation RCTFabricUIManagerWrapper +{ + std::shared_ptr _manager; +} + +- (instancetype)initWithManager:(std::shared_ptr)manager +{ + self = [super init]; + if (self) { + _manager = manager; + } + return self; +} + +- (std::shared_ptr)manager +{ + return _manager; +} + +- (void)invalidate +{ +} + +@end + +@implementation RCTBridge (RCTFabricUIManagerWrapper) + +- (std::shared_ptr)fabricUIManager +{ + RCTFabricUIManagerWrapper *wrapper = [self jsBoundExtraModuleForClass:[RCTFabricUIManagerWrapper class]]; + if (wrapper) { + return [wrapper manager]; + } + return nullptr; +} + +@end