suppose there is lots of text in text tag of react native , then i want to add a button at the end of this text ( more ).
<View style={styles.container}>
{" "}
<Text style={styles.paragraph}>
{" "}
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the
1500s, when an unknown printer took a galley of type and scrambled it to
make a type specimen book. It has survived not only five centuries, but also
the leap into electronic typesetting, remaining essentially unchanged. It
was popularised in the 1960s with the release of Letras{" "}
</Text>{" "}
<Pressable>
{" "}
<Text>more</Text>{" "}
</Pressable>{" "}
</View>;
I can use pressable but it is a block element , i want it be inline. so that text and button can stay together.
2
Answers
You can use react-native-read-more library instead of doing on your own. However, if you want to learn how to do it. I strongly suggest that go to this library and read how it should have done it 🙂
Wrap all
Text
andPressable
components with one top levelText
component and everything is inlined.