react-native icon indicating copy to clipboard operation
react-native copied to clipboard

lineHeight on Text component not rendering consistently on iOS vs Android

Open axelander opened this issue 10 years ago • 4 comments

Seems like setting the lineHeight property on a Text component gives different results on Android vs iOS. Tested without custom font and still the same issue. lineheight_example

Digging in to the source it seems like it has something to do with view.setLineSpacing(PixelUtil.toPixelFromSP(lineHeight), 0);. Setting the multiplier to 1 gives at least the same spacing between all lines but then the height gets screwed up and I guess we want to keep it at zero. Any thoughts on why this happens?

axelander avatar Feb 01 '16 10:02 axelander

Hey axelander, thanks for reporting this issue!

React Native, as you've probably heard, is getting really popular and truth is we're getting a bit overwhelmed by the activity surrounding it. There are just too many issues for us to manage properly.

  • If you don't know how to do something or something is not working as you expect but not sure it's a bug, please ask on StackOverflow with the tag react-native or for more real time interactions, ask on Discord in the #react-native channel.
  • If this is a feature request or a bug that you would like to be fixed, please report it on Product Pains. It has a ranking feature that lets us focus on the most important issues the community is experiencing.
  • We welcome clear issues and PRs that are ready for in-depth discussion. Please provide screenshots where appropriate and always mention the version of React Native you're using. Thank you for your contributions!

facebook-github-bot avatar Feb 01 '16 10:02 facebook-github-bot

@axelander, did you find a way to fix this? It seems to only occur with custom fonts. I'm on 0.20.0.

kozlowskij avatar Mar 24 '16 20:03 kozlowskij

@kozlowskij Yes, the problem only occured with custom fonts for me too, my mistake. I got a bit closer to consistent rendering by running the font through fontbakery fix for vertical metrics.

axelander avatar Mar 28 '16 08:03 axelander

In case anyone come here in the future, this seems to be caused by UILabel's instead of RN (http://stackoverflow.com/questions/5414730/custom-installed-font-not-displayed-correctly-in-uilabel)

sbycrosz avatar May 07 '16 19:05 sbycrosz