Auto cross axis margins are ignored in wrapping containers and baseline rows
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start in CalculateLayout.cpp at STEP 8, which the report identifies as overwriting cross-axis positions set by STEP 7 when items have auto margins. Read the related Flexbox steps cited in the issue and compare the reported wrap and baseline cases. Add the described cases as gentest fixtures and verify their cross positions and sizes match the expected values.
由索引模型根据 Issue 内容生成。
描述
Report
- I have searched existing issues and this is not a duplicate
Issues and Steps to Reproduce
With flexWrap: 'wrap' or 'wrap-reverse', or in a row where any item uses baseline alignment, cross axis auto margins are ignored.
Take a row 200 wide with children 50x50 and 50x10, the second with marginTop: 'auto', and read the second child's top under each alignItems. For the baseline column there is no wrap and the first child has alignSelf: 'baseline'.
Expected Behavior
Top 40 in every case, as without wrap. Following CSS Flexbox 1 (9.4 steps 8 and 11, 9.6 steps 13 and 14), auto margins take the line's free space, and such an item is not stretched, baseline aligned or aligned by align-self.
Actual Behavior
alignItems |
no wrap | wrap | baseline | expected |
|---|---|---|---|---|
flex-start |
40 | 0 | 0 | 40 |
center |
40 | 20 | 20 | 40 |
flex-end |
40 | 40 | 40 | 40 |
stretch |
40 | 0 | 0 | 40 |
With wrap, marginBottom: 'auto' or both margins auto give the same column (expected 0 and 20), and under stretch a second child with no height gets top 0 and height 50 (expected top 50, height 0). alignItems: 'baseline' with marginBottom: 'auto' gives 40 (expected 0). YGErrataAll and YGErrataNone agree.
The cause is STEP 8 in CalculateLayout.cpp, which runs in both cases. It sets each item's cross position from its alignment with auto margins as 0, overwriting STEP 7's offset. Found in #2045.
Link to Code
The trees above use only the public C API, and I can add them as gentest fixtures with a fix.
- 主要语言
- C++
- 星标
- 18.9k
- 派生
- 1.6k
- 平均合并
- 2 天 5 小时
- 30 天内合并 PR
- 12
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
react/yoga 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 35/100
维护者通常 1 天内回复
-
Measured nodes in a cached subtree grow by a rounding step on every layout pass可能已有人在做 @salmanmkc 于 5 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 68/100
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 68/100
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 72/100
维护者通常 1 天内回复
-
Stale computedFlexBasis is reused across layouts: a flex: 1 node keeps its previous size after relayout at a new root size可能已有人在做 @mozzius 于 63 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 52/100
维护者通常 1 天内回复
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 65/100
-
难度 1/5 1 小时以内 新手友好度 91/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
NVIDIA-RTX/NRI#312 ·
维护者通常 1 天内回复
-
permute_q_b_proj / permute_wv_proj accept scale factors from another device可能已有人在做 @0z5a 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
deepseek-ai/FlashMLA#247 ·
维护者通常 1 天内回复
-
Linux npm packaging leaves workspace files that block subsequent CI checkout可能已有人在做 @Spockkk0225 今天认领。 未关闭ci
难度 2/5 1-3 小时 新手友好度 73/100
维护者通常 1 天内回复