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.
efemoney
08/28/2023, 6:11 AM
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.