Skip to content

Commit e377853

Browse files
NickGerlemanfacebook-github-bot
authored andcommitted
Fix sizing and alignment issues with multi-line containers (#1513)
Summary: X-link: facebook/react-native#41916 Fixes #1300 Fixes #1008 This fixes a smattering of issues related to both sizing and aligment of multi-line-containers: 1. We were previously incorrectly bounding the size of each flex line to the min/max of the entire container. 2. Per-line leads were sometimes incorrectly contributing to alignment within the line 3. The cross dim size used for multi-line alignment is not correct, or correctly clamped. If the available size comes from a max constraint, that was incorrectly used instead of a definite size, or size of content. Leads were entirely skipped for min constraint. Need to test how breaking this is, to see if it might need to go behind an errata. See related PRs: 1. #1491 2. #1493 3. #1013 Changelog: [General][Fixed] - Fix Yoga sizing and alignment issues with multi-line containers Differential Revision: D52087013
1 parent c01c4cb commit e377853

File tree

12 files changed

+2533
-69
lines changed

12 files changed

+2533
-69
lines changed

gentest/fixtures/YGAlignContentTest.html

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,4 +342,57 @@
342342
<div style="width:100px; height: 100px; align-items: center; flex-direction: row; align-content:stretch;">
343343
<div style="height: 10px; width: 10px; align-content:stretch;"></div>
344344
</div>
345-
</div>
345+
</div>
346+
347+
<div id="align_content_stretch_with_min_cross_axis" style="width: 500px; min-height: 500px; flex-direction: row; flex-wrap: wrap; align-content: stretch;">
348+
<div style="width: 400px; height: 200px;"></div>
349+
<div style="width: 400px; height: 200px;"></div>
350+
</div>
351+
352+
<div id="align_content_stretch_with_max_cross_axis" style="width: 500px; max-height: 500px; flex-direction: row; flex-wrap: wrap; align-content: stretch;">
353+
<div style="width: 400px; height: 200px;"></div>
354+
<div style="width: 400px; height: 200px;"></div>
355+
</div>
356+
357+
<div id="align_content_stretch_with_max_cross_axis_and_border_padding" style="width: 500px; max-height: 500px; flex-direction: row; flex-wrap: wrap; align-content: stretch; border: solid black 5px; padding: 2px">
358+
<div style="width: 400px; height: 200px;"></div>
359+
<div style="width: 400px; height: 200px;"></div>
360+
</div>
361+
362+
<div id="align_content_space_evenly_with_min_cross_axis" style="width: 500px; min-height: 500px; flex-direction: row; flex-wrap: wrap; align-content: space-evenly;">
363+
<div style="width: 400px; height: 200px;"></div>
364+
<div style="width: 400px; height: 200px;"></div>
365+
</div>
366+
367+
<div id="align_content_space_evenly_with_max_cross_axis" style="width: 500px; max-height: 500px; flex-direction: row; flex-wrap: wrap; align-content: space-evenly;">
368+
<div style="width: 400px; height: 200px;"></div>
369+
<div style="width: 400px; height: 200px;"></div>
370+
</div>
371+
372+
<div id="align_content_space_evenly_with_max_cross_axis_violated" style="width: 500px; max-height: 300px; flex-direction: row; flex-wrap: wrap; align-content: space-evenly;">
373+
<div style="width: 400px; height: 200px;"></div>
374+
<div style="width: 400px; height: 200px;"></div>
375+
</div>
376+
377+
<div id="align_content_space_evenly_with_max_cross_axis_violated_padding_and_border" style="width: 500px; max-height: 300px; flex-direction: row; flex-wrap: wrap; align-content: space-evenly; border: solid black 5px; padding: 2px">
378+
<div style="width: 400px; height: 200px;"></div>
379+
<div style="width: 400px; height: 200px;"></div>
380+
</div>
381+
382+
<div id="align_content_space_around_and_align_items_flex_end_with_flex_wrap" style="width: 300px; height: 300px; flex-direction: row; flex-wrap: wrap; align-content: space-around;align-items: flex-end;">
383+
<div style="height: 50px; width: 150px;"></div>
384+
<div style="height: 100px; width: 120px;"></div>
385+
<div style="height: 50px; width: 120px;"></div>
386+
</div>
387+
388+
<div id="align_content_space_around_and_align_items_center_with_flex_wrap" style="width: 300px; height: 300px; flex-direction: row; flex-wrap: wrap; align-content: space-around;align-items: center;">
389+
<div style="height: 50px; width: 150px;"></div>
390+
<div style="height: 100px; width: 120px;"></div>
391+
<div style="height: 50px; width: 120px;"></div>
392+
</div>
393+
394+
<div id="align_content_space_around_and_align_items_flex_start_with_flex_wrap" style="width: 300px; height: 300px; flex-direction: row; flex-wrap: wrap; align-content: space-around;align-items: flex-start;">
395+
<div style="height: 50px; width: 150px;"></div>
396+
<div style="height: 100px; width: 120px;"></div>
397+
<div style="height: 50px; width: 120px;"></div>
398+
</div>

gentest/fixtures/YGFlexWrapTest.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,3 +147,13 @@
147147
</div>
148148
</div>
149149
</div>
150+
151+
<div id="wrap_with_min_cross_axis" style="width: 500px; min-height: 500px; flex-direction: row; flex-wrap: wrap;">
152+
<div style="width: 400px; height: 200px;"></div>
153+
<div style="width: 400px; height: 200px;"></div>
154+
</div>
155+
156+
<div id="wrap_with_max_cross_axis" style="width: 500px; max-height: 500px; flex-direction: row; flex-wrap: wrap;">
157+
<div style="width: 400px; height: 200px;"></div>
158+
<div style="width: 400px; height: 200px;"></div>
159+
</div>

java/tests/com/facebook/yoga/YGAbsolutePositionTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1124,7 +1124,6 @@ public void test_percent_absolute_position_infinite_height() {
11241124
}
11251125

11261126
@Test
1127-
@Ignore
11281127
public void test_absolute_layout_percentage_height_based_on_padded_parent() {
11291128
YogaConfig config = YogaConfigFactory.create();
11301129
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);

0 commit comments

Comments
 (0)