假设在react native的text标签中有很多文本,那么我想在这个文本的末尾添加一个按钮(更多)。
<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>;
我可以使用pressable,但它是一个块元素,我希望它是内联的。这样文本和按钮就可以呆在一起。
2条答案
按热度按时间rnmwe5a21#
你可以使用react-native-read-more库来代替自己做。但是,如果你想学习如何做。我强烈建议你去这个库,阅读它应该如何做:)
bjg7j2ky2#
用一个顶级
Text
组件 Package 所有Text
和Pressable
组件,所有组件都是内联的。