Change theme
Help
Press space for more information.
Show links for this issue (Shortcut: i, l)
Copy issue ID
Previous Issue (Shortcut: k)
Next Issue (Shortcut: j)
Sign in to use full features.
Vote: I am impacted
Notification menu
Refresh (Shortcut: Shift+r)
Go home (Shortcut: u)
Pending code changes (auto-populated)
View issue level access limits(Press Alt + Right arrow for more information)
Attachment actions
Unintended behavior
View staffing
Description
Sample code:https://pastebin.com/ULepkyBE
Text calculates its minimum intrinsic width as the width required to lay out 1 word, where words seem to be delineated by spaces. For example "One, Two, Three" will have its min width defined by the length of "Three" whereas "One,Two,Three" will have its min width defined by the entire String.
Changing the
maxLines
ofText(text = "One, Two, Three", maxLines = 1)
has no effect on intrinsicMinWidth, which results in undesired measurement behaviors when using intrinsic width.In the provided sample code, text is laid out to the width of the widest word in the String but then, due to maxLines, that word is clipped. This results in a width that is inconsistent with the remaining content.
I also ran into issues caused by this when building a custom layout whose minimum intrinsic width should be the sum of its children's intrinsic widths. I can't rely on
Text
to tell me its minimum accurately in a situation where my custom layout wants to force a single line of text.