Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text numberOfLines prop causes text to be cut off on Android #22419

Closed
3 tasks done
shlokamin opened this issue Nov 26, 2018 · 10 comments
Closed
3 tasks done

Text numberOfLines prop causes text to be cut off on Android #22419

shlokamin opened this issue Nov 26, 2018 · 10 comments
Labels
Bug Component: Text Platform: Android Android applications. Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@shlokamin
Copy link

shlokamin commented Nov 26, 2018

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(R) Core(TM) 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

@GhizlaneA
Copy link

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.

@shlokamin
Copy link
Author

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

@sanjeev141985
Copy link

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.

Same here

@CatapultJesse
Copy link

Related: #19117

@ben-brott
Copy link

I am also seeing this issue without any margin, reproduced here: https://snack.expo.io/H1B9TwwMH
image

@chetan-plrch
Copy link

The same issue happened with me, any workaround ?

@curtismenmuir
Copy link

Same issue seen with RN version 0.59.3

@curtismenmuir
Copy link

curtismenmuir commented Sep 11, 2019

Issue seems to be fixed by changing the font family on the Text component to a monospace variant.
EG
fontFamily: "monospace"
Not sure numberOfLines considers the width of the letters before truncating the text string.

@stale
Copy link

stale bot commented Dec 11, 2019

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Dec 11, 2019
@stale
Copy link

stale bot commented Dec 18, 2019

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

@stale stale bot closed this as completed Dec 18, 2019
@facebook facebook locked as resolved and limited conversation to collaborators Dec 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Component: Text Platform: Android Android applications. Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

9 participants