Skip to content

Commit

Permalink
Fixes layout of nodes with YGDisplayNone and YGPositionTypeAbsolute (#…
Browse files Browse the repository at this point in the history
…1068)

Summary:
Pull Request resolved: facebook/yoga#1068

There is an issue in react-native when the Yoga node position type is set to absolute and display: none is set where the node layout calculation gives the absolute dimensions, rather than the expected 0 x 0.

Here are some OSS issues tracking this:
#18415
microsoft/react-native-windows#7289

## Changelog

[General] [Fix] - Fixes layout of nodes with YGDisplayNone and YGPositionTypeAbsolute

Reviewed By: Andrey-Mishanin

Differential Revision: D26849307

fbshipit-source-id: 197618aa3c4e1b3b7efeba7ea4efd30b2d1c982d
  • Loading branch information
rozele authored and facebook-github-bot committed Mar 10, 2021
1 parent 81c895f commit b15f8a3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ReactCommon/yoga/yoga/Yoga.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3557,7 +3557,8 @@ static void YGNodelayoutImpl(
if (performLayout) {
// STEP 10: SIZING AND POSITIONING ABSOLUTE CHILDREN
for (auto child : node->getChildren()) {
if (child->getStyle().positionType() != YGPositionTypeAbsolute) {
if (child->getStyle().display() == YGDisplayNone ||
child->getStyle().positionType() != YGPositionTypeAbsolute) {
continue;
}
YGNodeAbsoluteLayoutChild(
Expand Down

0 comments on commit b15f8a3

Please sign in to comment.