Fix fill text MeasureFunc constraint, strengthen nested flex prompt
layout.ts: When text fills width (stretch in col parent), MeasureFunc now uses Yoga's constraint width directly instead of clamping to the 100px default fixedWidth. prompt: Emphasize that ALL intermediate flex containers need w="fill", not just the first level. grow inside HUG = zero width.
This commit is contained in:
parent
766cf11699
commit
ba4333d798
|
|
@ -427,8 +427,9 @@ function configureTextLeaf(
|
|||
yogaChild.setWidth(fixedWidth)
|
||||
}
|
||||
yogaChild.setMeasureFunc((width, widthMode, _height, _heightMode) => {
|
||||
const constraintW =
|
||||
widthMode === MeasureMode.Undefined ? fixedWidth : Math.min(width, fixedWidth || width)
|
||||
const constraintW = fillsWidth
|
||||
? (widthMode === MeasureMode.Undefined ? fixedWidth : width)
|
||||
: (widthMode === MeasureMode.Undefined ? fixedWidth : Math.min(width, fixedWidth || width))
|
||||
const cacheKey = Math.round(constraintW)
|
||||
const cached = cache.get(cacheKey)
|
||||
if (cached) return cached
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ justify/items require flex — always declare flex="row" or flex="col" before us
|
|||
|
||||
A hug parent shrinks to fit its children. A fill child stretches to its parent. These can't be circular — if the parent hugs, at least one child must have a concrete size.
|
||||
|
||||
Nested flex containers inside a column parent need w="fill" to stretch, otherwise they collapse to zero width.
|
||||
Nested flex containers inside a column parent need w="fill" to stretch, otherwise they collapse to zero width. ⚠ This applies to ALL intermediate containers, not just the first level. If you have `flex="col" > flex="col" > flex="row"`, EVERY level needs w="fill". A `grow={1}` child inside a HUG parent gets zero width — the parent must have a concrete size (fixed w or w="fill").
|
||||
|
||||
There is no margin property. Padding on a container pushes all children equally from the edges. To offset a single child, wrap it in a Frame with its own padding.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue