mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-21 02:26:18 +08:00
Summary: This will be useful for this class and for subclasses soon. For instance, when we draw something in `drawRect:`, we need to know exact content frame for rendering. Reviewed By: mdvacca Differential Revision: D7751855 fbshipit-source-id: 5d688368edd7b4f3c8c19d54ca701a9cc361270b
42 lines
1.1 KiB
Plaintext
42 lines
1.1 KiB
Plaintext
/**
|
|
* 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.
|
|
}
|
|
|
|
- (void)updateLayoutMetrics:(LayoutMetrics)layoutMetrics
|
|
oldLayoutMetrics:(LayoutMetrics)oldLayoutMetrics
|
|
{
|
|
[super updateLayoutMetrics:layoutMetrics oldLayoutMetrics:oldLayoutMetrics];
|
|
|
|
_layoutMetrics = layoutMetrics;
|
|
}
|
|
|
|
@end
|