#1932·yoga

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

Author: hzxiaoshengCreated Apr 14, 2026Updated Apr 15, 2026

Demo JSX Code:

javascript
<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