Skip to content

Unexpected zero width for 100% width node #1827

@yyalansavage

Description

@yyalansavage

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:

Image

https://www.yogalayout.dev/playground?code=DwGQhgng9grgLgAgMZQHYDMCWBzAvAb3xgGcBTAdVICMARU9MGAGzmIC4EGmyBfHgPgBQCBMAByUACakExOBCakC+AO6ZJcABZsAzAFYADABoEm0jk1w2ARkMmwTHKgCScUgFt2AciSlUbgCcvPiEREXEpGTkFJUIABzBJSUxUbA5rYzUNbS9GOChggWEw8IlpWXlFZSytDgAmO1NzbEsOADYDPgQAelCS0TKoytjVdVqEACJDAFIJkzMLKx0DBD5e4vDuwb7gLcihXfBoeCEgA

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions