-
Notifications
You must be signed in to change notification settings - Fork 462
<p></p> gets too much space after #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@nbastoWM did you found a solution yet? |
Editing line 11 in HTMLView.js will do the trick |
thx @grittathh |
This has done the trick :
|
@raphaelvigee can you explain your solution? thx |
The |
If you go into the installed node module package and go to the file |
First off, thanks so much for this. I told my client that we would be able to keep the existing formatting from data that was originally formatted for the web for this React Native project, I was pretty worried when I found at that we could not natively. This library was a lifesaver. Everything works just as I would hope for, except for this paragraph issue...there is a lot of space by default when there are two newlines. I'm not sure if its possible to style newlines, but as it is right now, two newlines creates a fairly large and noticeable gap in my project (0.44). Its really easy to edit the code from within your node module directly and set it to one newline (which looks perfect) - but it would be great if the PARAGRAPH_BREAK const in htmlToElement.js was a prop in HtmlView so you could override it. Not the end of the world, I just have to be careful that my changes don't get overwritten. |
Also, is there any reason why |
Encountering this issue as well on my side. The span solution isn't ideal as it causes a whole bunch of other formatting inconsistencies. |
There is a parent |
Having this issue as well, is an official fix planned ? ( RN 0.44.3 ) |
I can't speak for the developer here, but I didn't have time to wait around. You could always submit a PR with that extra I ended up adding support for other stuff that I needed, like ordered and unordered lists. |
From |
@isilher or anyone else have an example of how to fix this issue? I tried all of the above to remedy the giant spacing in between p tags to no avail. Using [email protected] with Expo. Update: My issue had to do with |
Just dropping a note here to clarify something I hadn't realised... by killing the default newline-inserting behaviour using
Not perfect, but a handy workaround. Use |
What worked for me was to delete break lines from html text and add styles: htmlText = htmlText.replace(/(\r\n|\n|\r)/gm, '');
[...]
<HTMLView
stylesheet={htmlStyles}
addLineBreaks={false}
value={htmlText}
/>
[...]
const htmlStyles = StyleSheet.create({
p: {
marginTop: 5,
marginBottom: 5
},
ul: {
marginTop: 5,
marginBottom: 5
},
ol: {
marginTop: 5,
marginBottom: 5
}
});
|
Hi,
If I have some text like
<p>123</p><p>456</p>
the final result has like 3 or 4 break lines between the two paragraphs.I tryed to put negative margins and paddings on p tag style but with no success.
Is there any way reduce that space?
Thanks.
The text was updated successfully, but these errors were encountered: