Support for min-content / max-content? #1126
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Report
Hi there, I'm working on a react-native layout that I can't seem to solve without using
max-width: min-content
, which doesn't seem to be supported in Yoga.Have a look here:
http://jsfiddle.net/shmax/e3hud7xp/
The idea is that the blue and red text both occupy the parent space, and may not overflow it. The blue text is dominant and will win any argument over available real estate with the red text (so the red text will show ellipses, but the blue text won't unless it's wider than the overall space). The catch is that I have a value, p, which is the point along the width at which the red text will hold its ground; in other words, if there is not enough room for red and blue, and blue needs more than p percent of the available width, then both red and blue will truncate with ellipses at p.
I'm still trying to find alternate solutions, but so far the only thing I can get to work relies on that
max-width: min-content
you see in the.item
style.In the meantime, I thought I'd inquire about it here. I checked all the open and closed issues, and nobody has asked about either min-content or max-content, so maybe I'm missing something obvious.
Would a PR be welcome?
I have seen this gap documented in source code "yoga.cpp". I think it would be a good parity item for browser layout. I have been working to improve the health of this repo WRT contribution, and a PR would be welcome.
@NickGerleman Thank you for replying. I spent a few weeks trying to figure this out, and while I was able to rough-out crude min-content/max-content functionality, the use case in my jsfiddle still wouldn't work. I had other tasks to work on and ultimately had to give up, but if you're serious about improving the health of this repo I would think a great first step would be to figure out why building in a Windows environment doesn't work:
buck test //:yoga
doesn't workFrom there, I would be very keen to hear your thoughts about how to implement this feature.