mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-01-12 22:50:10 +08:00
Fabric: Explicit dirtying Yoga nodes for Text component (and co.)
Summary: With recent changes, simple cloning a component does not mean that underlying Yoga node will be dirtied. Autodirtying is only performed if the child nodes were dirtied and/or if the YGStyles were changed. That's not the case for Text component which does not have direct layotable children, so we have to call `dirtyLayout` explicitly. Reviewed By: JoshuaGross Differential Revision: D14508277 fbshipit-source-id: 2c52d7d40da963a976c7d28a13781cc1755ef591
This commit is contained in:
committed by
Facebook Github Bot
parent
ab86085caf
commit
9a0047f368
@@ -71,6 +71,8 @@ class ParagraphComponentDescriptor final
|
||||
paragraphShadowNode->setMeasureCache(
|
||||
measureCache_ ? measureCache_.get() : nullptr);
|
||||
|
||||
paragraphShadowNode->dirtyLayout();
|
||||
|
||||
// All `ParagraphShadowNode`s must have leaf Yoga nodes with properly
|
||||
// setup measure function.
|
||||
paragraphShadowNode->enableMeasurement();
|
||||
|
||||
@@ -141,6 +141,7 @@ void YogaLayoutableShadowNode::setSize(Size size) const {
|
||||
style.dimensions[YGDimensionWidth] = yogaStyleValueFromFloat(size.width);
|
||||
style.dimensions[YGDimensionHeight] = yogaStyleValueFromFloat(size.height);
|
||||
yogaNode_.setStyle(style);
|
||||
yogaNode_.setDirty(true);
|
||||
}
|
||||
|
||||
void YogaLayoutableShadowNode::setPositionType(
|
||||
@@ -150,6 +151,7 @@ void YogaLayoutableShadowNode::setPositionType(
|
||||
auto style = yogaNode_.getStyle();
|
||||
style.positionType = positionType;
|
||||
yogaNode_.setStyle(style);
|
||||
yogaNode_.setDirty(true);
|
||||
}
|
||||
|
||||
void YogaLayoutableShadowNode::layout(LayoutContext layoutContext) {
|
||||
|
||||
Reference in New Issue
Block a user