question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Text numberOfLines prop causes text to be cut off on Android

See original GitHub issue

Environment

Run react-native info in your terminal and paste its contents here. React Native Environment Info: System: OS: macOS High Sierra 10.13.6 CPU: (8) x64 Intel® Core™ i7-7700HQ CPU @ 2.80GHz Memory: 817.49 MB / 16.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 8.9.4 - /usr/local/bin/node Yarn: 1.5.1 - /usr/local/bin/yarn npm: 6.4.1 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 11.3, macOS 10.13, tvOS 11.3, watchOS 4.3 Android SDK: API Levels: 23, 25, 26, 27, 28 Build Tools: 23.0.1, 25.0.0, 25.0.1, 25.0.2, 26.0.1, 26.0.2, 26.0.3, 27.0.3 System Images: android-25 | Google APIs Intel x86 Atom_64, android-27 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom IDEs: Android Studio: 3.1 AI-173.4907809 Xcode: 9.3/9E145 - /usr/bin/xcodebuild npmPackages: react: ^16.5.1 => 16.5.2 react-native: 0.57.5 => 0.57.5 npmGlobalPackages: react-native-cli: 2.0.1 react-native-git-upgrade: 0.2.7

Description

When using the numberOfLines Text prop on Android along with any horizontal margin, it causes the edges of the last line to be cut off horizontally as shown below:

image

Reproducible Demo

As shown in the snack below, the first Text component that has margin gets cut off on the last line, while the second one with no margin does not get cut off.

Note: Make sure you’re viewing the snack on Android

https://snack.expo.io/@shlokamin/text-number-of-lines-bug

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10

github_iconTop GitHub Comments

5reactions
GhizlaneAcommented, Feb 18, 2019

Hi, I am facing the same issue with react-native 0.57.8 version, is there any plan to fix this soon ? thanks in advance.

3reactions
shlokamincommented, Feb 18, 2019

Same, for now I’m just truncating text based on an arbitrary character count which is far from ideal 😕

Read more comments on GitHub >

github_iconTop Results From Across the Web

Text is getting cut off in android for react native - Stack Overflow
It's only happening in android, working fine in iOS. I have written following code <Text numberOfLines={1} adjustsFontSizeToFit minimumFontScale ...
Read more >
[Solved]-Text is getting cut off in android for react native-Reactjs
As it turns out, the last line of our paragraphs were getting cut off due to 'highQuality' value of textBreakStrategy parameter. We changed...
Read more >
🧁 Mark Dalgleish on Twitter: "Found another surprising text ...
When text is truncated with the `numberOfLines` prop, it can cause the entire text node to shift below its regular baseline. https://t.co/2TiiaNE2Pe" / ......
Read more >
Why My Text Is Going Off Screen? The Truth about React ...
The Text is wrapping, but not enough so we can see it entirely. 1.2 why does the solution works: FlexGrow & FlexShrink. In...
Read more >
Text - Litho
Text used to replace the standard Android ... ellipsis at the end of truncated lines. Warning: specifying this prop causes measurement to run...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found