LoginSignup
1
0

はじめに

個人開発アプリのレイアウト作成中に、「行頭10文字のみを表示したい!」と思ったのでその方法についてまとめます。

解決方法

slice(〇文字目から表示,〇文字目まで表示) を使う

今回は行頭10文字を表示し、それ以降は "..."と表示されます。

tsx
<Text>
{article.contents.slice(0, 10)}...
</Text>

イメージ

image.png

参考

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0