React Native Create Ellipsis Clipped Text in React Native iOS Android 或如何在 React Native 中用点隐藏额外的文本

React Native Create Ellipsis Clipped Text in React Native iOS Android or How to make extra text hidden with dots in React native

<Text style={styles.TextStyle}> 
  This is the Sample Ellipsis Text for Ellipsis from Start.This is the Sample Ellipsis Text for Ellipsis from Start.This is the Sample Ellipsis Text for Ellipsis from Start.
</Text>

如果内容超过我需要显示的内容,我想使用点

参考答案numberOfLines。 只需使用 numberOfLines 数量,如果你输入 numberOfLines = { 2 },它将显示 2 行,额外的文本将以点为单位。

<Text style={styles.TextStyle} numberOfLines = { 1 } ellipsizeMode = 'head'> 
  This is the Sample Ellipsis Text for Ellipsis from Start.This is the Sample Ellipsis Text for Ellipsis from Start.This is the Sample Ellipsis Text for Ellipsis from Start.
</Text>