Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aspect ratio does not respect min/max dimensions #677

Open
1 task done
michaelmerrild opened this issue Dec 1, 2017 · 2 comments
Open
1 task done

Aspect ratio does not respect min/max dimensions #677

michaelmerrild opened this issue Dec 1, 2017 · 2 comments

Comments

@michaelmerrild
Copy link

Report

Issues and Steps to Reproduce

Aspect ratio does not respect min/max dimensions.

In the example below, the computed height is 200, but should be 50 because max-width is set.

const assert = require('assert');
const yoga = require('yoga-layout');

let rootNode = yoga.Node.create();
let childNode = yoga.Node.create();

childNode.setWidth(400);
childNode.setMaxWidth(100);
childNode.setAspectRatio(2);

rootNode.insertChild(childNode, 0);
rootNode.calculateLayout(1080, 768);

assert.strictEqual(childNode.getComputedWidth(), 100);
assert.strictEqual(childNode.getComputedHeight(), 50);

rootNode.freeRecursive();

Expected Behavior

The documentation states that

AspectRatio respects the Min and Max dimensions of an item.

Actual Behavior

The height is calculated based on the explicit width.

@nick-thompson
Copy link

nick-thompson commented Nov 28, 2018

Hey @michaelmerrild I'm currently seeing the same thing on the latest master. Did this get anywhere?

Edit: probably should mention I'm using the C/C++ library directly.

Edit(2): Just rolled back from master to 1.10.0, this issue is still present.

@Strate
Copy link

Strate commented Dec 8, 2020

Is facebook maintaining issues on github? Issue is 3 years old without any response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants