最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin0浏览0评论
<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>

I want to use dots if content exceed more than what I need to display

<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>

I want to use dots if content exceed more than what I need to display

Share Improve this question asked Nov 22, 2019 at 6:53 Varunkumar GandeVarunkumar Gande 5996 silver badges18 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 5

Reference for the answer numberOfLines. just use numberOfLines quantity, if you put numberOfLines = { 2 }, it will display 2 lines and extra text will be in dots.

<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>

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论