I think the cause is on this line: HTML.js#L269
(The regex pattern /\s/g)
Bug report.
No.
Yes.
I have searched. It could be alternative to #118
Tested on Android.
Not tested yet.
Not tested yet.
Environment:
React: 16.6.0-alpha.8af6728
React native: 0.57.4
react-native-render-html: 3.10.0
Target Platform:
Android (7.0)
white spaces should be rendered. They are not breaking spaces.
(Write what you thought would happen.)
White spaces were not rendered.
Not implement yet.
Same problem, only spaces between 2 html tags like
render() {
const html = '<strong><em>Hello</em><strong> <strong>World</strong>';
return (<HTML html={html}/>);
}
Result:

Shitty fix:
const html = '<strong><em>Hello</em><strong> <strong>World</strong>';
const fixedHtml = html.replace(/> </g, '><span style="color:white;">-</span><');
I'm having the same issue. It happens in iOS as well.
Here is a repro: https://github.com/alexisbronchart/rn-html-bug

Same problem, only spaces between 2 html tags like
render() { const html = '<strong><em>Hello</em><strong> <strong>World</strong>'; return (<HTML html={html}/>); }Result:
Shitty fix:
const html = '<strong><em>Hello</em><strong> <strong>World</strong>'; const fixedHtml = html.replace(/> </g, '><span style="color:white;">-</span><');
.replace(/>\s\ <') works as well
This line https://github.com/archriss/react-native-render-html/blob/928d8e825377181f383934f0b33747ae1315f345/src/HTML.js#L272 could be replaced with:
const strippedData = data && data.replace(/\s+/g, ' ')
It seems to work fine, at least for my use case.
@Exilz @bd-arc do you guys think it would be OK to merge this? I can send a PR.
The regex pattern should be /[\t\r\n ]+/g instead of \s. Because \s is included many types of unicode spaces. There types of space should be rendered in HTML.
Wikipedia page about white spaces:
https://en.m.wikipedia.org/wiki/Whitespace_character
Isn't this issue fixed with https://github.com/thoughtis/react-native-render-html/pull/1 ?
@caioiglesias It has not been merged on master of this repository. The pending PR is #350. We are looking into it.
@DiepEsc That is already handled L277
I'm closing this issue in favor of #118. The solution to this issue is complex, and won't be included before release 6.0.
Most helpful comment
.replace(/>\s\ <') works as well