Text cut off at the bottom (in Android)
See original GitHub issueIs 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
- Create a brand new app (with
create-react-native-app
for example) - Render a text
- 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:
(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 aText
component, usingpaddingTop
) - This is a similar bug as https://github.com/facebook/react-native/issues/7687, which is closed due to inactivity
Issue Analytics
- State:
- Created 6 years ago
- Reactions:9
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Android Textview text cut off at bottom - Stack Overflow
One of your LinearLayouts has height set to fill_parent . change it to wrap_content . Also, remove the min_height attribute.
Read more >When you see cutoff at the bottom of your textview - Treehouse
If such situation happens, just change android:layout_width part in your text view parenthesis to "wrap_content". ex) android:layout_width=" ...
Read more >Some characters missing or cut off when displayed on screen ...
When you view your document in Microsoft Word, some characters may be missing, or the top (or bottom) of some characters may be...
Read more >android textview cut off bottom
3,234 Points When you see cutoff at the bottom of your textview Not a question but FYI, If such situation happens, just change...
Read more >Truncated/Cut off text in various places? - Google Pixel 6 Pro
It's a combination of Font size & Display size that is probably your issue. Try mine and see if that helps. #2 markdoc,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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 like0.5
on aTextView
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.
Indeed, this was fixed in 0.52 🎉 🙌