Skip to content

[Text component] Missing ellipsis when text contains line breaks (\n) [iOS only] #41405

Description

@DanielMarkiel

Description

Hi,
I noticed a potential bug which results in missing ellipsis on iOS when limiting lines on the Text component if passed text contains line breaks (\n).
The text is being truncated properly to the set numberOfLines but it's missing the ... at the end (ellipsizeMode set to tail).
image

React Native Version

0.72.6

Output of npx react-native info

Bug reproducible at https://snack.expo.dev/QXsCyRwYN
Expo 49.0

Steps to reproduce

  1. Import React Native Text component
  2. Use component e.g.
<Text numberOfLines={2} ellipsizeMode="tail">
  {text}
</Text>
  1. Set text const as e.g.
const text = "Change code \n in the editor and \n watch it change on your phone!"
  1. Run code on iOS
    *The text should contain at least the same number of line breaks (\n) as the set limit in the numberOfLines prop

Snack, screenshot, or link to a repository

https://snack.expo.dev/QXsCyRwYN

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions