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 cut off at the bottom (in Android) #17064

Closed
Jpunt opened this issue Dec 4, 2017 · 5 comments
Closed

Text cut off at the bottom (in Android) #17064

Jpunt opened this issue Dec 4, 2017 · 5 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@Jpunt
Copy link

Jpunt commented Dec 4, 2017

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

Environment:
OS: macOS High Sierra 10.13.1
Node: 8.2.1
Yarn: 0.27.5
npm: 5.3.0
Watchman: 4.7.0
Xcode: Xcode 9.1 Build version 9B55
Android Studio: 3.0 AI-171.4443003

Packages: (wanted => installed)
react: 16.0.0 => 16.0.0
react-native: 0.50.3 => 0.50.3

Steps to Reproduce

  1. Create a brand new app (with create-react-native-app for example)
  2. Render a text
  3. Set the style of this text to {fontSize: 72, lineHeight: 72}

Expected Behavior

I expected the text to not be cut off at the bottom, as it does (correctly) when leaving out lineHeight.

Actual Behavior

As soon as we define a lineHeight (even if it's the same as its fontSize) the bottom part gets cut off:

screen shot 2017-12-04 at 15 18 03

(where the first one is without lineHeight and the second one is with {fontSize: 72, lineHeight: 72})

Reproducible Demo

https://snack.expo.io/BJT3KRzZM

Additional notes

  • It's not possible to compensate the cut off part with a paddingBottom (which could be done with similar issues in higher areas of a Text component, using paddingTop)
  • This is a similar bug as Top of Text cut off when lineHeight < fontSize #7687, which is closed due to inactivity
@mudasirkhan
Copy link

You have to increase the line height accordingly in order for it to render completely. This probably takes the height for only capital letters.

@Jpunt
Copy link
Author

Jpunt commented Dec 5, 2017

But.. what do we do when we want multiple lines of text that are closer together than the line-height it takes to render the last line?

screen shot 2017-12-05 at 09 15 56

What you're suggesting results in:

screen shot 2017-12-05 at 09 13 24

You're right in that it fixes the g at the end, but the rest of the text does not look how I want it to look. Please reopen this, because it's not a weird use case at all.
Edit: Sorry, I was confused with the status of #7687 for being closed 😅

@tdekoning
Copy link
Contributor

I've looked into if this is even possible in native Android, and turns out that it works just fine.
Setting android:lineSpacingMultiplier at a value of something like 0.5 on a TextView will result in the lines of text being quite close to each other, but the letters are never cut off.

I did not have the time to figure out where in the React-native logic this fails, but it seems like a bug in React-native to me.

@dickie81
Copy link

dickie81 commented Jan 9, 2018

Hey - this should be fixed in latest release (0.52).

Merged PR here: #16448

@Jpunt
Copy link
Author

Jpunt commented Feb 9, 2018

Indeed, this was fixed in 0.52 🎉 🙌

@Jpunt Jpunt closed this as completed Feb 9, 2018
@facebook facebook locked as resolved and limited conversation to collaborators Feb 9, 2019
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Feb 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

5 participants