jsdf / react-native-htmlview

A React Native component which renders HTML content as native views
ISC License
2.71k stars 467 forks source link

Space between html tags is huge even tho I wrapped my content in "<div>" #319

Open nikita-zot-1408 opened 3 years ago

nikita-zot-1408 commented 3 years ago

I have very big distance between elements even tho I have my code like this.

<HTMLView
          value={`<div>${currentPostDetails?.text.replace(
            /<br\\?>|\r?\n\s*/g,
            '',
          )}</div>`}
          stylesheet={checkTheme ? webViewStyleLight : webViewStyleDark}
        />

My content is still displayed like this:

Screenshot 2021-05-04 at 12 21 23

Any suggestions on how to solve this please?

akenarong999 commented 3 years ago

Got this problem too. Any solution?... pls.

yestay90 commented 3 years ago

the same is here.

daveyjones commented 3 years ago

You need to add addLineBreaks={false}.

MohdUmer commented 2 years ago

when use addLineBreaks={false} height still to huge... any solution?

joemewes commented 2 months ago

I had this also, even with addLineBreaks={false}. I found lots of null in RootComponent element with a children data value of '\n\n'. Don't have time to fully debug but a temp fix for me was to add the following in my custom renderNode function.


if (node.data === '\n\n') {
      return null;
}