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.

Line Height Not Respected in iOS

See original GitHub issue

Hello! First off, thanks for the library! It has been very useful thus far. One thing I seem to be struggling with is that while I am trying to style a paragraph’s lineHeight, iOS seems to ignore this property while Android is respecting it.

...
<MarkdownView style={styles.markdownContainer} styles={styles.markdown}>
  {markdown}
</MarkdownView>
...

const styles = {
  ...
  markdown: {
    paragraph: {
      lineHeight: 28, // Respected in Android, not iOS
    }
  }
  ...
}

Any thoughts?

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:2
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
Ragnar-Hcommented, Apr 5, 2018

@Benjamin-Dobell I’ve got an expo snack reproducing the issue here https://snack.expo.io/@ragnar/https:-github.com-benjamin-dobell-react-native-markdown-view-issues-25

Try running it on Android and iOS to see the difference.

The issue seems to be that lineHeight is not propagated from a parent Text to child Text components. I’ve inspected the output of a paragraph render with react-devtools, which is:

<Text style={{ fontFamily: 'OpenSans-Regular', fontSize: 16, lineHeight: 55 }}> <--`paragraph` styling
  <Text>This is the rendered text</Text> <---non existent `text` styling
  <Text>Some styles are passed by the parent</Text>
  <Text>lineHeight on iOS is not one of them :(</Text>
  <Text>and these Text components use `textContentRenderer('text')`</Text>
</Text>

I tried removing this line locally, which seems to fix the issue. But I’m not sure what side effects will come from removing it.

2reactions
stigicommented, Apr 19, 2018

@Ragnar-H is right. Instead of removing the line he mentioned it is enough to pass rules={{text:{render:undefined}}} in the MarkdownView props.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Line Spacing is Crowded in iPhone - Litmus
I'd try setting the line-height with no unit or a relative unit (like em ). So, for example, if you have a font-size:16px;...
Read more >
css line-height not working on mobile device - Stack Overflow
I have tried to align some items vertical middle using line-height in my hyprid app (ionic). how ...
Read more >
UIWebView: issues with line-height in iOS11b9
Hello Apple, We have noticed a problem in our production app, related to zooming of text in a UIWebView, in iOS11b9. As a...
Read more >
Line height not working. - Forums - CSS-Tricks
I am trying to add line-height to my blog post from firebug but the changes are not shown.
Read more >
How to Fix Line Height in Outlook.com - Email on Acid
The ESP I use does not allow to add CSS in the <head> or <body> tag. Is there way to fix this with...
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