From 0af806e96c20c826f5a4bd55a3f73f512d6bb5af Mon Sep 17 00:00:00 2001 From: Arushi Kesarwani Date: Mon, 5 Jun 2023 23:31:10 -0700 Subject: [PATCH] Fixing line truncation issue when numberOfLines = {1} (#37667) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/37667 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: 3377c38ab65e6801bddb1f262432f8d156a2641f --- .../main/java/com/facebook/react/views/text/ReactTextView.java | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextView.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextView.java index 6cda1af267c..43ffc0d31dc 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextView.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextView.java @@ -577,7 +577,6 @@ public class ReactTextView extends AppCompatTextView implements ReactCompoundVie public void setNumberOfLines(int numberOfLines) { mNumberOfLines = numberOfLines == 0 ? ViewDefaults.NUMBER_OF_LINES : numberOfLines; - setSingleLine(mNumberOfLines == 1); setMaxLines(mNumberOfLines); }