react / react/yoga

min-width in percent isn't calculated against parent node

Open
#872 2 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Algorithm
Dominant language
C++
Stars
18.9k
Forks
1.6k
Avg merge
1m
Merged PRs (30d)
1

Description

It seems that Yoga doesn't calculate min-width against parent node's width. Interestingly it occurs only when using percentage, e.g. 50%.

P.S. Thank you for the amazing library! Ink is a very happy user!

Report

Issues and Steps to Reproduce

See https://codesandbox.io/s/vv0rlkokz7 for reproduction. childNode's width should be half of parentNode's width, but it seems to be half of rootNode's width for some reason.

Expected Behavior

It should calculate 50% min-width against parent node's width.

Actual Behavior

It calculates min-width against root node.

Link to Code

https://codesandbox.io/s/vv0rlkokz7

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the CodeSandbox reproduction linked in the issue and trace how the child node's percentage min-width is calculated relative to its parent and root. The fix is complete when the child node's 50% min-width is based on the parent node's width and the reproduction behaves as expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.