Open matteopole opened 8 months ago
Does maxLines = 1
parameter solve your problem?
Yes specifying maxLines makes it so that the Ellipsis is shown also on iOS.
However in my actual use-case I want as many lines to be rendered as they fit. So I don't know how to leverage that workaround.
Thanks!
On Thu, Jan 11, 2024, 9:45 AM Ivan Matkov @.***> wrote:
Does maxLines = 1 parameter solve your problem?
— Reply to this email directly, view it on GitHub https://github.com/JetBrains/compose-multiplatform/issues/4116#issuecomment-1886635406, or unsubscribe https://github.com/notifications/unsubscribe-auth/BBIJ4MNX54VQQD6RM72D6WLYN6RDTAVCNFSM6AAAAABBVNJC4SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBWGYZTKNBQGY . You are receiving this because you authored the thread.Message ID: @.***>
It's not "a bug" but unimplemented additional behavior that exists on Android. The current workaround is to specify maxLines
(any specific value, not necessary "1") manually.
Thank you for taking a look and the prompt reply!
Do you have an idea how I could apply the workaround if the number of lines is not fixed a priori? For example is there a way I could query something like numberOfLinesThatFitMaxHeight from the Text composable?
I'd start with just height / heightOfLine
formula
TextLayoutResult.getLineEnd seems to return the wrong value for Javascript/Browser platform also.
setting maxLines does not seem to help
Is it related to maybe a bug in the workaround !
MultiParagraph.getLineEnd
Paragraph.getLineEnd
SkiaParagraph.getLineEnd
....
// workarounds for https://bugs.chromium.org/p/skia/issues/detail?id=11321 :(
// we are waiting for fixes
...
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.
Describe the bug Setting overflow = TextOverflow.Ellipsis for a Text composable does not display the ellipsis on IOS when the text is truncated.
Affected platforms Select one of the platforms below:
Versions
To Reproduce
Expected behavior Displayed ellipsis when the text is truncated, e.g. "Lorem ipsum..."
Instead only the truncated text is shown, e.g. "Lorem ipsum"
Screenshots iOS
Android
Additional context Printing some debug info, I saw that the getLineEnd also returns the wrong character:
Log result: Layout result has overflow: true Layout result last line index: 3 Layout result last character index: 55