2018-04-10 16:37:11 -07:00
|
|
|
/**
|
|
|
|
* 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) {
|
2018-05-08 22:56:04 -07:00
|
|
|
oldProps = _props ?: std::make_shared<ViewProps>();
|
2018-04-10 16:37:11 -07:00
|
|
|
}
|
2018-05-08 22:56:04 -07:00
|
|
|
_props = props;
|
2018-04-10 16:37:11 -07:00
|
|
|
|
|
|
|
auto oldViewProps = *std::dynamic_pointer_cast<const ViewProps>(oldProps);
|
|
|
|
auto newViewProps = *std::dynamic_pointer_cast<const ViewProps>(props);
|
|
|
|
|
2018-05-14 15:43:28 -07:00
|
|
|
if (oldViewProps.backgroundColor != newViewProps.backgroundColor) {
|
|
|
|
self.backgroundColor = [UIColor colorWithCGColor:newViewProps.backgroundColor.get()];
|
2018-04-10 16:37:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: Implement all sutable non-layout <View> props.
|
|
|
|
}
|
|
|
|
|
2018-05-08 18:50:05 -07:00
|
|
|
- (void)updateLayoutMetrics:(LayoutMetrics)layoutMetrics
|
|
|
|
oldLayoutMetrics:(LayoutMetrics)oldLayoutMetrics
|
|
|
|
{
|
|
|
|
[super updateLayoutMetrics:layoutMetrics oldLayoutMetrics:oldLayoutMetrics];
|
|
|
|
|
|
|
|
_layoutMetrics = layoutMetrics;
|
|
|
|
}
|
|
|
|
|
2018-04-10 16:37:11 -07:00
|
|
|
@end
|