I have Text with maxLines set to 2. It uses elipss...
# compose
c
I have Text with maxLines set to 2. It uses elipssis too. But after the elipssis I want to put another piece of text that says "More" Essentially this
This is some long text that
rolls over to multipl... More
I have everything working pretty nicely except I'm not sure if theres a recomended way for putting that More on the last line there. Any ideas?
e
sounds like a simpler case of what https://github.com/romainguy/combo-breaker can do
❤️ 1
e
Poor mans algorithm is to measure and trim. Keep a local state of the trimmed text, use onTextLayout to determine where you need to break the text on the second line based on the measured size of the the “… More” and update the local text. It needs to layout the original text for at least one frame first.
The improvement here would be to do the text measurement fully by hand. So by the time it lays out youve already calculated all that is needed.