mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: Conceptually, it always must be node owner's responsibility, but for the root node, we have to make an exception because there is no another parent node and there is no another component which has access to YogaNode. Reviewed By: fkgozali Differential Revision: D7958251 fbshipit-source-id: 0bdaea87adbd323c758bc3c28f325be615aa90f3
30 lines
784 B
C++
30 lines
784 B
C++
/**
|
|
* 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.
|
|
*/
|
|
|
|
#include "RootShadowNode.h"
|
|
#include "conversions.h"
|
|
|
|
namespace facebook {
|
|
namespace react {
|
|
|
|
ComponentName RootShadowNode::getComponentName() const {
|
|
return ComponentName("RootView");
|
|
}
|
|
|
|
void RootShadowNode::layout() {
|
|
ensureUnsealed();
|
|
layout(getProps()->layoutContext);
|
|
|
|
// This is the rare place where shadow node must layout (set `layoutMetrics`)
|
|
// itself because there is no a parent node which usually should do it.
|
|
YGNode *yogaNode = const_cast<YGNode *>(yogaNode_.get());
|
|
setLayoutMetrics(layoutMetricsFromYogaNode(*yogaNode));
|
|
}
|
|
|
|
} // namespace react
|
|
} // namespace facebook
|