YogaLayoutableShadowNode::YogaLayoutableShadowNode()
    : yogaNode_({}), yogaConfig_(nullptr) {
  initializeYogaConfig(yogaConfig_);

  yogaNode_.setConfig(&yogaConfig_);
  yogaNode_.setContext(this);
  yogaNode_.setDirty(true);
}
YogaLayoutableShadowNode::YogaLayoutableShadowNode(
    const YogaLayoutableShadowNode &layoutableShadowNode)
    : yogaNode_(layoutableShadowNode.yogaNode_), yogaConfig_(nullptr) {
  initializeYogaConfig(yogaConfig_);

  yogaNode_.setConfig(&yogaConfig_);
  yogaNode_.setContext(this);
  yogaNode_.setOwner(nullptr);
  yogaNode_.setDirty(true);
}
YogaLayoutableShadowNode::YogaLayoutableShadowNode(
  const SharedYogaStylableProps &props,
  const SharedShadowNodeSharedList &children
):
  yogaNode_({}),
  yogaConfig_(nullptr) {

  assert(props);
  assert(children);

  initializeYogaConfig(yogaConfig_);
  yogaNode_.setConfig(&yogaConfig_);
  yogaNode_.setStyle(props->yogaStyle);
  yogaNode_.setContext(this);
  yogaNode_.setDirty(true);

  YogaLayoutableShadowNode::setYogaNodeChildrenBasedOnShadowNodeChildren(&yogaNode_, children);
}
YogaLayoutableShadowNode::YogaLayoutableShadowNode(
  const SharedYogaLayoutableShadowNode &shadowNode,
  const SharedYogaStylableProps &props,
  const SharedShadowNodeSharedList &children
):
  yogaNode_(shadowNode->yogaNode_),
  yogaConfig_(nullptr) {

  initializeYogaConfig(yogaConfig_);
  yogaNode_.setConfig(&yogaConfig_);
  yogaNode_.setContext(this);
  yogaNode_.setOwner(nullptr);
  yogaNode_.setDirty(true);

  if (props) {
    yogaNode_.setStyle(props->yogaStyle);
  }

  if (children) {
    YogaLayoutableShadowNode::setYogaNodeChildrenBasedOnShadowNodeChildren(&yogaNode_, children);
  }
}