mirror of
https://github.com/status-im/react-native.git
synced 2025-01-09 09:12:02 +00:00
d94a9e2640
Summary: Given that fact that life-time of YGNode and ShadowNode objects must be idential and that we always allocate ShadowNode on heap, we can embed YGNode object right inside ShadowNode object and use pointer to it safely. That allows us to save additional memory allocation for every single layoutable shadow node! Whoo-hoo! Reviewed By: fkgozali Differential Revision: D8070121 fbshipit-source-id: 6eefbca1b7ac0a8aad235513b4c4899d414835f2
30 lines
737 B
C++
30 lines
737 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 <fabric/view/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.
|
|
setLayoutMetrics(layoutMetricsFromYogaNode(yogaNode_));
|
|
}
|
|
|
|
} // namespace react
|
|
} // namespace facebook
|