diff --git a/ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputComponentDescriptor.h b/ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputComponentDescriptor.h index 48f998305e4..1d482590e4c 100644 --- a/ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputComponentDescriptor.h +++ b/ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputComponentDescriptor.h @@ -118,7 +118,7 @@ protected: // Set new props on node const_cast(textInputShadowNode->getConcreteProps()).yogaStyle.padding() = result; // Communicate new props to Yoga part of the node - textInputShadowNode->setProps((YogaStylableProps)textInputShadowNode->getConcreteProps()); + textInputShadowNode->updateYogaProps(); } } diff --git a/ReactCommon/fabric/components/view/yoga/YogaLayoutableShadowNode.cpp b/ReactCommon/fabric/components/view/yoga/YogaLayoutableShadowNode.cpp index 47f1d942259..3a7fa622604 100644 --- a/ReactCommon/fabric/components/view/yoga/YogaLayoutableShadowNode.cpp +++ b/ReactCommon/fabric/components/view/yoga/YogaLayoutableShadowNode.cpp @@ -36,7 +36,7 @@ YogaLayoutableShadowNode::YogaLayoutableShadowNode( yogaNode_(&initializeYogaConfig(yogaConfig_)) { yogaNode_.setContext(this); - setProps(static_cast(*fragment.props)); + updateYogaProps(); setChildren(YogaLayoutableShadowNode::getYogaLayoutableChildren()); } @@ -58,7 +58,7 @@ YogaLayoutableShadowNode::YogaLayoutableShadowNode( .yogaNode_.isDirty() == yogaNode_.isDirty()); if (fragment.props) { - setProps(dynamic_cast(*fragment.props)); + updateYogaProps(); } if (fragment.children) { @@ -182,9 +182,11 @@ void YogaLayoutableShadowNode::setChildren( yogaNode_.setDirty(!isClean); } -void YogaLayoutableShadowNode::setProps(YogaStylableProps const &props) { +void YogaLayoutableShadowNode::updateYogaProps() { ensureUnsealed(); + auto props = static_cast(*props_); + // Resetting `dirty` flag only if `yogaStyle` portion of `Props` was changed. if (!yogaNode_.isDirty() && (props.yogaStyle != yogaNode_.getStyle())) { yogaNode_.setDirty(true); diff --git a/ReactCommon/fabric/components/view/yoga/YogaLayoutableShadowNode.h b/ReactCommon/fabric/components/view/yoga/YogaLayoutableShadowNode.h index 4ed1d7c7db3..b75981b79fc 100644 --- a/ReactCommon/fabric/components/view/yoga/YogaLayoutableShadowNode.h +++ b/ReactCommon/fabric/components/view/yoga/YogaLayoutableShadowNode.h @@ -59,9 +59,9 @@ class YogaLayoutableShadowNode : public LayoutableShadowNode { void setChildren(YogaLayoutableShadowNode::UnsharedList children); /* - * Sets Yoga styles based on given `YogaStylableProps`. + * */ - void setProps(const YogaStylableProps &props); + void updateYogaProps(); /* * Sets layoutable size of node.