Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,7 @@ bool layoutAbsoluteDescendants(
// we need to mutate these descendents. Make sure the path of
// nodes to them is mutable before positioning.
child->cloneChildrenIfNeeded();
cleanupContentsNodesRecursively(child);
const Direction childDirection =
child->resolveDirection(currentNodeDirection);
// By now all descendants of the containing block that are not absolute
Expand Down
7 changes: 6 additions & 1 deletion packages/react-native/ReactCommon/yoga/yoga/node/Node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,12 @@ void Node::cloneChildrenIfNeeded() {
child = resolveRef(config_->cloneNode(child, this, i));
child->setOwner(this);

if (child->hasContentsChildren()) [[unlikely]] {
if (child->style().display() == Display::Contents) [[unlikely]] {
// The contents node's children are treated as children of the
// contents node's parent for layout purposes, so they need
// to be cloned as well.
child->cloneChildrenIfNeeded();
} else if (child->hasContentsChildren()) [[unlikely]] {
child->cloneContentsChildrenIfNeeded();
}
}
Expand Down
Loading