Skip to content

Incorrect cached child size is used because YGNodeCanUseCachedMeasurement() does not respect min/max dimensions #1003

Open
@nickolas-pohilets

Description

Report

Issues and Steps to Reproduce

See the attached example.

Child node has height = 10, minHeight = 40%, maxHeight = 60%.

When parent is measured against height = NaN, child height is computed to be 10, which is correct.

But then parent is laid out against height = 30.
Now child height should be max(40% * 30, min(10, 60% * 30)) = max(12, min(10, 18)) = 12.
But YGNodeCanUseCachedMeasurement() returns true and cached height of 10 is used instead.

Expected Behavior

In all the cases, final layout should have child height of 12.

Actual Behavior

In some of the scenarios incorrect cached height is used.

Link to Code

https://pastebin.com/x5e6ZL2b

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions