iamacup / react-native-markdown-display

React Native 100% compatible CommonMark renderer
MIT License
590 stars 169 forks source link

First paragraph in hierarchy should not have marginTop #111

Closed pke closed 10 months ago

pke commented 4 years ago

Since margins do not collapse in RN like they do in web CSS its often introducing little bugs when paragraphs have a marginTop of 10 by default. Especially if there is only one paragraph in the rendered hierarchy at that level. In that case no top margin should be applied (like it would in web CSS).

habovh commented 3 years ago

I'd even add that paragraphs should not have a top margin at all. In my opinion, every block (as opposed to inline) components should have a bottom margin.

That way, every block handles the margin/separation with the next block, not the previous one. The absence of a previous block (i.e. only one block, or the first block in the hierarchy) would not change the way the current block is laid out.

pke commented 3 years ago

I have to agree. In my layout library elements only have a bottom margin to space them apart.