diff --git a/React/Fabric/RCTConversions.h b/React/Fabric/RCTConversions.h index c4d8f407b7d..1f0716eed46 100644 --- a/React/Fabric/RCTConversions.h +++ b/React/Fabric/RCTConversions.h @@ -1,3 +1,4 @@ + /** * Copyright (c) Facebook, Inc. and its affiliates. * diff --git a/ReactCommon/fabric/components/view/yoga/YogaLayoutableShadowNode.cpp b/ReactCommon/fabric/components/view/yoga/YogaLayoutableShadowNode.cpp index 7886204ffef..407664b94d9 100644 --- a/ReactCommon/fabric/components/view/yoga/YogaLayoutableShadowNode.cpp +++ b/ReactCommon/fabric/components/view/yoga/YogaLayoutableShadowNode.cpp @@ -101,6 +101,20 @@ void YogaLayoutableShadowNode::setProps(const YogaStylableProps &props) { yogaNode_.setStyle(props.yogaStyle); } +void YogaLayoutableShadowNode::setSize(Size size) const { + auto style = yogaNode_.getStyle(); + style.dimensions[YGDimensionWidth] = yogaStyleValueFromFloat(size.width); + style.dimensions[YGDimensionHeight] = yogaStyleValueFromFloat(size.height); + yogaNode_.setStyle(style); +} + +void YogaLayoutableShadowNode::setPositionType( + YGPositionType positionType) const { + auto style = yogaNode_.getStyle(); + style.positionType = positionType; + yogaNode_.setStyle(style); +} + void YogaLayoutableShadowNode::layout(LayoutContext layoutContext) { if (!getIsLayoutClean()) { ensureUnsealed(); diff --git a/ReactCommon/fabric/components/view/yoga/YogaLayoutableShadowNode.h b/ReactCommon/fabric/components/view/yoga/YogaLayoutableShadowNode.h index ea388e39ba7..012f67091c3 100644 --- a/ReactCommon/fabric/components/view/yoga/YogaLayoutableShadowNode.h +++ b/ReactCommon/fabric/components/view/yoga/YogaLayoutableShadowNode.h @@ -17,6 +17,7 @@ #include #include #include +#include namespace facebook { namespace react { @@ -63,6 +64,16 @@ class YogaLayoutableShadowNode : public LayoutableShadowNode, */ void setProps(const YogaStylableProps &props); + /** + * Sets layoutable size of node. + */ + void setSize(Size size) const; + + /** + * Sets position type of Yoga node (relative, absolute). + */ + void setPositionType(YGPositionType positionType) const; + #pragma mark - LayoutableShadowNode void cleanLayout() override; diff --git a/ReactCommon/fabric/core/primitives/RawProps.h b/ReactCommon/fabric/core/primitives/RawProps.h index 0e1b52c11b1..6112e6abe66 100644 --- a/ReactCommon/fabric/core/primitives/RawProps.h +++ b/ReactCommon/fabric/core/primitives/RawProps.h @@ -75,7 +75,7 @@ class RawProps { /* * Returns a const unowning pointer to `RawValue` of a prop with a given name. - * Returns `nullptr`, it a prop with the given name does not exist. + * Returns `nullptr` if a prop with the given name does not exist. */ const RawValue *at(const std::string &name) const noexcept { auto iterator = map_.find(name); diff --git a/ReactCommon/fabric/core/propsConversions.h b/ReactCommon/fabric/core/propsConversions.h index 003d9ab644d..7ec739133c8 100644 --- a/ReactCommon/fabric/core/propsConversions.h +++ b/ReactCommon/fabric/core/propsConversions.h @@ -57,8 +57,8 @@ T convertRawProp( return sourceValue; } - // Special case: `null` always means `the prop was removed, use default - // value`. + // Special case: `null` always means "the prop was removed, use default + // value". if (!rawValue->hasValue()) { return defaultValue; }