react / react/yoga

Padding on container parent is not applied to children

Open
#455 3 comments 0 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

1.{*wm: LAY_EXACTLY, hm: LAY_EXACTLY, aw: 375.000000 ah: 202.000000 initial
  2.{*wm: AT_MOST, hm: AT_MOST, aw: 303.000000 ah: 130.000000 measure
  2.}*wm: AT_MOST, hm: AT_MOST, d: (148.666672, 31.333334) measure
  2.{*wm: AT_MOST, hm: AT_MOST, aw: 303.000000 ah: 130.000000 measure
   3.{*wm: AT_MOST, hm: EXACTLY, aw: 303.000000 ah: 28.000000 measure
   3.}*wm: AT_MOST, hm: EXACTLY, d: (16.000000, 28.000000) measure
   3.{wm: EXACTLY, hm: EXACTLY, aw: 303.000000 ah: 28.000000 flex
   3.}wm: EXACTLY, hm: EXACTLY, d: (303.000000, 28.000000) flex
  2.}*wm: AT_MOST, hm: AT_MOST, d: (303.000000, 28.000000) measure
  2.{*wm: LAY_EXACTLY, hm: LAY_EXACTLY, aw: 88.000000 ah: 88.000000 flex
  2.}*wm: LAY_EXACTLY, hm: LAY_EXACTLY, d: (88.000000, 88.000000) flex
  2.{[skipped] wm: LAY_AT_MOST, hm: LAY_EXACTLY, aw: 303.000000 ah: 55.333336 => d: (148.666672, 31.333334) flex
  2.{wm: LAY_AT_MOST, hm: LAY_EXACTLY, aw: 303.000000 ah: 52.000000 flex
   3.{[skipped] wm: AT_MOST, hm: EXACTLY, aw: 303.000000 ah: 28.000000 => d: (16.000000, 28.000000) measure
   3.{[skipped] wm: LAY_EXACTLY, hm: LAY_EXACTLY, aw: 303.000000 ah: 28.000000 => d: (303.000000, 28.000000) flex
  2.}wm: LAY_AT_MOST, hm: LAY_EXACTLY, d: (303.000000, 28.000000) flex
 1.}*wm: LAY_EXACTLY, hm: LAY_EXACTLY, d: (375.000000, 202.000000) initial
{layout: {width: 375, height: 202, top: 0, left: 0}, flexDirection: 'column', justifyContent: 'center', alignItems: 'center', flexGrow: 0, flexShrink: 0, flexBasis: nan%, overflow: 'visible', padding: 36pt, width: nan%, height: nan%, children: [
  {layout: {width: 88, height: 88, top: 3.33333, left: 143.5}, flexDirection: 'column', alignItems: 'stretch', flexGrow: 0, flexShrink: 0, flexBasis: nan%, overflow: 'visible', width: 88pt, height: 88pt, },
  {layout: {width: 148.667, height: 31.3333, top: 115.333, left: 113.167}, flexDirection: 'column', alignItems: 'stretch', flexGrow: 0, flexShrink: 0, flexBasis: nan%, overflow: 'visible', marginTop: 24pt, marginStart: nan%, marginEnd: nan%, width: nan%, height: nan%, },
  {layout: {width: 303, height: 28, top: 170.667, left: 36}, flexDirection: 'row', justifyContent: 'center', alignItems: 'stretch', flexGrow: 0, flexShrink: 0, flexBasis: nan%, overflow: 'visible', marginTop: 24pt, marginStart: nan%, marginEnd: nan%, width: nan%, height: nan%, maxWidth: 320pt, children: [
    {layout: {width: 303, height: 28, top: 0, left: 0}, flexDirection: 'column', alignItems: 'stretch', flexGrow: 1, flexShrink: 0, flexBasis: nan%, overflow: 'visible', width: nan%, height: 28pt, },
  ]},
]},

As you can see, the parent element has padding set to 36, but, it's first child is top is 3.3333.

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 from the layout trace in the issue and reproduce the parent with padding 36 and its first child. Inspect how the parent’s padding is accounted for when positioning children. Done means the child’s top position reflects the parent padding and the reported layout dimensions remain correct.

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
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.