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

LineHeight Style Prop not working

Open mastermoo opened this issue 7 years ago • 4 comments
trafficstars

I try to give the Markdown text lineHeight styling, but somehow it just ignores it. This is what I tried:

const styles = {
  text: {
    fontFamily: "Avenir",
    color: "#444",
    fontSize: 17,
    lineHeight: 24
  }
};

mastermoo avatar Aug 06 '18 16:08 mastermoo

I too am seeing a similar occurrence.

erikkgagewhitt avatar Aug 23 '18 14:08 erikkgagewhitt

Any progress on this one?

mi5q avatar Aug 30 '18 12:08 mi5q

Have you tried any other properties? Maybe paragraph? See for example: https://github.com/mientjan/react-native-markdown-renderer/blob/master/src/lib/styles.js#L81 they set line height for the listUnorderedItemIcon based on platform.

bensinjin avatar Oct 03 '18 23:10 bensinjin

Have you tried any other properties? Maybe paragraph? See for example: https://github.com/mientjan/react-native-markdown-renderer/blob/master/src/lib/styles.js#L81 they set line height for the listUnorderedItemIcon based on platform.

This does not work, because lineHeight is not an allowed style attribute for View.

I created a pull request to fix the issue #85

in the meantime you can supply a custom styling rule to get the result you want:

text: (node, children, parent, styles) => (
  <Text key={node.key} style={myMarkdownStyles.text}>
    {node.content}
  </Text>
),

janrop avatar Oct 17 '18 14:10 janrop