mirror of
https://github.com/status-im/react-native.git
synced 2025-02-25 23:55:23 +00:00
Fabric: Introducting RCTViewComponentView
Summary: Implementation of the native view component of <View>. Root View also must have dedicated class even if its empty now. Reviewed By: mdvacca Differential Revision: D7526406 fbshipit-source-id: 9e14c9f679396c2cdb2d64c99086bb19df37c25c
This commit is contained in:
parent
db92b16e04
commit
568529e1ec
21
React/Fabric/Mounting/RCTRootComponentView.h
Normal file
21
React/Fabric/Mounting/RCTRootComponentView.h
Normal file
@ -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 <UIKit/UIKit.h>
|
||||
|
||||
#import <React/RCTViewComponentView.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* UIView class for root <View> component.
|
||||
*/
|
||||
@interface RCTRootComponentView : RCTViewComponentView
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
12
React/Fabric/Mounting/RCTRootComponentView.mm
Normal file
12
React/Fabric/Mounting/RCTRootComponentView.mm
Normal file
@ -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
|
22
React/Fabric/Mounting/RCTViewComponentView.h
Normal file
22
React/Fabric/Mounting/RCTViewComponentView.h
Normal file
@ -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 <UIKit/UIKit.h>
|
||||
|
||||
#import <React/RCTComponentViewProtocol.h>
|
||||
#import <React/UIView+ComponentViewProtocol.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* UIView class for <View> component.
|
||||
*/
|
||||
@interface RCTViewComponentView : UIView <RCTComponentViewProtocol>
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
33
React/Fabric/Mounting/RCTViewComponentView.mm
Normal file
33
React/Fabric/Mounting/RCTViewComponentView.mm
Normal file
@ -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 <fabric/view/ViewProps.h>
|
||||
|
||||
using namespace facebook::react;
|
||||
|
||||
@implementation RCTViewComponentView
|
||||
|
||||
- (void)updateProps:(facebook::react::SharedProps)props
|
||||
oldProps:(facebook::react::SharedProps)oldProps
|
||||
{
|
||||
if (!oldProps) {
|
||||
oldProps = std::make_shared<ViewProps>();
|
||||
}
|
||||
|
||||
auto oldViewProps = *std::dynamic_pointer_cast<const ViewProps>(oldProps);
|
||||
auto newViewProps = *std::dynamic_pointer_cast<const ViewProps>(props);
|
||||
|
||||
if (oldViewProps.getBackgroundColor() != newViewProps.getBackgroundColor()) {
|
||||
self.backgroundColor = [UIColor colorWithCGColor:newViewProps.getBackgroundColor().get()];
|
||||
}
|
||||
|
||||
// TODO: Implement all sutable non-layout <View> props.
|
||||
}
|
||||
|
||||
@end
|
Loading…
x
Reference in New Issue
Block a user