diff --git a/React/Fabric/Mounting/RCTRootComponentView.h b/React/Fabric/Mounting/RCTRootComponentView.h new file mode 100644 index 000000000..687d4f73a --- /dev/null +++ b/React/Fabric/Mounting/RCTRootComponentView.h @@ -0,0 +1,21 @@ +/** + * 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 + +NS_ASSUME_NONNULL_BEGIN + +/** + * UIView class for root component. + */ +@interface RCTRootComponentView : RCTViewComponentView + +@end + +NS_ASSUME_NONNULL_END diff --git a/React/Fabric/Mounting/RCTRootComponentView.mm b/React/Fabric/Mounting/RCTRootComponentView.mm new file mode 100644 index 000000000..703c03e5d --- /dev/null +++ b/React/Fabric/Mounting/RCTRootComponentView.mm @@ -0,0 +1,12 @@ +/** + * 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 "RCTRootComponentView.h" + +@implementation RCTRootComponentView + +@end diff --git a/React/Fabric/Mounting/RCTViewComponentView.h b/React/Fabric/Mounting/RCTViewComponentView.h new file mode 100644 index 000000000..046030a8f --- /dev/null +++ b/React/Fabric/Mounting/RCTViewComponentView.h @@ -0,0 +1,22 @@ +/** + * 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 + +NS_ASSUME_NONNULL_BEGIN + +/** + * UIView class for component. + */ +@interface RCTViewComponentView : UIView + +@end + +NS_ASSUME_NONNULL_END diff --git a/React/Fabric/Mounting/RCTViewComponentView.mm b/React/Fabric/Mounting/RCTViewComponentView.mm new file mode 100644 index 000000000..24a985949 --- /dev/null +++ b/React/Fabric/Mounting/RCTViewComponentView.mm @@ -0,0 +1,33 @@ +/** + * 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 "RCTViewComponentView.h" + +#import + +using namespace facebook::react; + +@implementation RCTViewComponentView + +- (void)updateProps:(facebook::react::SharedProps)props + oldProps:(facebook::react::SharedProps)oldProps +{ + if (!oldProps) { + oldProps = std::make_shared(); + } + + auto oldViewProps = *std::dynamic_pointer_cast(oldProps); + auto newViewProps = *std::dynamic_pointer_cast(props); + + if (oldViewProps.getBackgroundColor() != newViewProps.getBackgroundColor()) { + self.backgroundColor = [UIColor colorWithCGColor:newViewProps.getBackgroundColor().get()]; + } + + // TODO: Implement all sutable non-layout props. +} + +@end