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

paddingTop, paddingBottom in containerStyle is not working

Open nighttiger1990 opened this issue 8 years ago • 3 comments

How can i set paddingTop=0 or paddingBottom=0 at containerStyle, i think children are set default marginTop and marinBottom which make wrong padding in containerStyle.

nighttiger1990 avatar Jan 08 '18 11:01 nighttiger1990

Hey @nighttiger1990 , I think I have similar problem. Did you find any solution before closing the issue?

PoojaVM avatar Apr 25 '18 08:04 PoojaVM

Same issue. How do I get rid of the top/bottom margins?

mfferreira avatar Dec 10 '18 21:12 mfferreira

For anyone in the future, I've been able to set negative margins via containerStyles. For my use case, it's almost always a single <p> tag being rendered - I don't know how it will stand up to other use cases.

containerStyle: {
  marginTop: -4,
  marginBottom: -4
}

The default text size is 14, so a margin of -4 leaves 10 pixels as margin. Not a "forever" solution, but good enough for some use cases

jacobsmith avatar Feb 14 '19 13:02 jacobsmith