I want a wrapped text that ends with an image icon, and tried the following.
<Text>
<Text
numberOfLines={2}
ellipsizeMode="tail"
>
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Ab quasi in dolor dolore recusandae ullam numquam labore sunt illo. Repellat in sed sit, pariatur voluptate distinctio! Perspiciatis inventore pariatur incidunt.
</Text>
<Image source={source} />
</Text>
The outer wrapper <Text />
is to ensure that the <Image />
icon stays inline with the text.
I was hoping it would look like below:
Lorem, ipsum dolor sit amet consectetur adipisicing elit.
Ab quasi in dolor dolore recusandae ullam... <Image />
However, adding the outer <Text />
seems to have removed the effect of numberOfLines
and I get the full text instead:
Lorem, ipsum dolor sit amet consectetur adipisicing elit.
Ab quasi in dolor dolore recusandae ullam numquam labore
sunt illo. Repellat in sed sit, pariatur voluptate
distinctio! Perspiciatis inventore pariatur incidunt. <Image />
Is it possible to achieve both the truncation via numberOfLines
and the inline <Image />
at the end?
Thanks,
2
Answers
I have created an example: