Is there exist some way to get the Truncated text in RN when we use numberOfLines?
For example:
Component
<Text style={{width: 50}} numberOfLines={3}>
Some very long text with tons of useful info
</Text>
Output
Some
very
long...
I want to know what exactly the text is visible to the end-user. Is it possible somehow?
Thanks for any help!
P.S. I tried to use Ref features to get the content but it contains props with the whole text so it didn't help
You can use the onTextLayout prop like this.
The e.nativeEvent.lines has each line in the text, if you have the text and the number of lines then you can use this array like below and view the texts in each line. This works in Android not sure about web.