Unexpected zero width for 100% width node
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 18.9k
- Forks
- 1.6k
- Avg merge
- 1m
- Merged PRs (30d)
- 1
Description
Here the 50% width node has zero width - I would expect it here to be 50% width of its parent node so 250 / 2 . Perhaps this is something I don't understand about containing blocks, is this a bug or my misunderstanding?
Note if root node has default auto width/height, the 50% node is always the full width of the parent (regardless of the %age value); Only when root node has default alignItems:'stretch' does it show at expected 50%
<Layout config={{useWebDefaults: false}}>
<Node style={{width:350, height:150, alignItems:'center'}}>
<Node style={{padding: 10,width:'auto'}}>
<Node style={{width: 250, height: 60}} />
<Node style={{width: "50%", height:30 }}/>
</Node>
</Node>
</Layout>
result:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked Yoga playground reproduction and compare the 50% child inside the auto-width parent against the case where the root uses the default alignItems:'stretch'. Trace how percentage width is resolved when the containing parent has auto width, and consider the issue done when the reproduction gives the child the expected 50% width without changing the documented containing-block behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100