Skip to content

calculateBaseline(node) may return NaN if the baselineChild has not been measured #1932

Description

@hzxiaosheng

Demo JSX Code:

<Layout config={{useWebDefaults: false}}>
  <Node style={{flexDirection: 'column'}}>
    <Node style={{flexDirection: 'row', width: 200, padding: 10, alignItems:'baseline'}}>
      <Node style={{ flexDirection: 'row', width: 100, height:100}}>
        <Node />
      </Node>
    </Node>
  </Node>
</Layout>

the yoga layout result : ⚠️⚠️⚠️the alignItems:'baseline' node got wrong lineHeight value of 0 ⚠️⚠️⚠️

Image

in constrast, Chrome/Safari perform well as expected

Image

this bug may resulting from wrong value returned by float calculateBaseline(const yoga::Node* node), if the baselineChild has not been measured, node->getLayout().measuredDimension(Dimension::Height) will return NaN value

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions