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 component cuts part of the text if fontWeight bold is used

See original GitHub issue

Environment

  React Native Environment Info:
    System:
      OS: macOS High Sierra 10.13.5
      CPU: x64 Intel(R) Core(TM) i5-4278U CPU @ 2.60GHz
      Memory: 514.83 MB / 16.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 8.9.0 - ~/.nvm/versions/node/v8.9.0/bin/node
      npm: 6.4.1 - ~/.nvm/versions/node/v8.9.0/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 11.4, macOS 10.13, tvOS 11.4, watchOS 4.3
    IDEs:
      Android Studio: 3.1 AI-173.4819257
      Xcode: 9.4.1/9F2000 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.5.0 => 16.5.0
      react-native: 0.57.2 => 0.57.2
    npmGlobalPackages:
      create-react-native-app: 1.0.0
      react-native-cli: 2.0.1

Description

In some devices when using a <Text> component with the syle fontWeight: 'bold' it removes the last word of the content of the text. My guess is that it’s related with the latest android version, I could test and reproduce this bug in the OnePlus 6 device.

See how the hello world app renders with/without the font style bold.

Before adding bold style to text screenshot_20181011-170135 After adding bold style to text screenshot_20181011-170110

Reproducible Demo

1. react-native init bug 
2. Connect an android device OnePlus 6 with latest version of android on the computer
3. Add `fontWeight: 'bold',` to App.js line 45 (instructions styles)
4. Run the app in the device 

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:19
  • Comments:36

github_iconTop GitHub Comments

19reactions
SanchezQbcommented, Dec 12, 2018

I also use a OnePlus and I had this issue. A workaround I used is to set fontFamily to ‘Roboto’

11reactions
MewXcommented, Aug 24, 2019

Still having the same issue.

I worked around it by setting lineHeight:

fontStyle: {
    <your other styles>,
    lineHeight: <your font size> * 1.2,
},
Read more comments on GitHub >

github_iconTop Results From Across the Web

Text is getting cut off in android for react native - Stack Overflow
This usually happens when you have this: fontWeight:bold and your android device is for example a Oneplus or Oppo (there are some other ......
Read more >
Text - React Native
A React component for displaying text. Text supports nesting, styling, and touch handling. In the following example, the nested title and body ...
Read more >
Text - Chakra UI
Text is the used to render text and paragraphs within an interface. ... Use Inspect Element to see the element that gets rendered...
Read more >
Customize React Native text color and other theme elements
Bold text is typically used to emphasize words and phrases you want the user to see. This could be a benefit, a special...
Read more >
font - CSS: Cascading Style Sheets - MDN Web Docs
Syntax · it must include values for: · it may optionally include values for: · font-style , font-variant and font-weight must precede font-size ......
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