1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

react nativeのtextで文字を折り返す

Last updated at Posted at 2019-12-09

TL;DR

  • numberOfLinesを使う
  • 特定の条件下でしかうまく動作しない模様

OK

<Text numberOfLines={2}>
  {this.state.bodyText}
</Text>
<View>
  <Text numberOfLines={2}>
    {this.state.bodyText}
  </Text>
</View>

NG

<Text>
  <Text numberOfLines={2}>
    {this.state.bodyText}
  </Text>
</Text>
<Text style={styles.bodyText}>
  {this.state.bodyText}
</Text>

const styles = StyleSheet.create({
  bodyText: {
     numberOfLines: 2
  },
});

補足

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?