Skip to content

Commit

Permalink
Fixing line truncation issue when numberOfLines = {1}
Browse files Browse the repository at this point in the history
Summary:
Changelog:
[Android][Fixed] - Fixing line truncation issue in Text containing /n when numberOfLines = {1}

When the text has multiple lines (with new line characters \n to hard-break the lines), and the first line is short enough to fit, Text component with `numberOfLines = {1}` doesn't display "..." at the end and rather disrespects the /n character.

With `numberOfLines = {1}`, On iOS it translates to
`line 1`, on Android & Web it translates to `line 1 line 2...`

**Expected Behavior :**

`line 1...`

Reviewed By: javache, NickGerleman

Differential Revision: D46175963

fbshipit-source-id: c8399095ee665cf93a7a90b885dcb4aa51098c02
  • Loading branch information
arushikesarwani94 authored and facebook-github-bot committed Jun 6, 2023
1 parent 5062553 commit 958700a
Showing 1 changed file with 0 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,6 @@ public boolean hasOverlappingRendering() {

public void setNumberOfLines(int numberOfLines) {
mNumberOfLines = numberOfLines == 0 ? ViewDefaults.NUMBER_OF_LINES : numberOfLines;
setSingleLine(mNumberOfLines == 1);
setMaxLines(mNumberOfLines);
}

Expand Down

0 comments on commit 958700a

Please sign in to comment.