White spaces were not rendered
See original GitHub issueFirst words
I think the cause is on this line: HTML.js#L269
(The regex pattern /\s/g
)
Is this a bug report or a feature request?
Bug report.
Have you read the guidelines regarding bug report?
No.
Have you read the documentation in its entirety?
Yes.
Have you made sure that your issue hasn’t already been reported/solved?
I have searched. It could be alternative to #118
Is the bug specific to iOS or Android? Or can it be reproduced on both platforms?
Tested on Android.
Is the bug reproductible in a production environment (not a debug one)?
Not tested yet.
Have you been able to reproduce the bug in the provided example?
Not tested yet.
Environment
Environment: React: 16.6.0-alpha.8af6728 React native: 0.57.4 react-native-render-html: 3.10.0
Target Platform: Android (7.0)
Steps to Reproduce
- Render html with a tag contain white spaces only (unicode white space)
Expected Behavior
white spaces should be rendered. They are not breaking spaces.
(Write what you thought would happen.)
Actual Behavior
White spaces were not rendered.
Reproducible Demo
Not implement yet.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:9 (2 by maintainers)
Top Results From Across the Web
JSX not rendering whitespace - javascript - Stack Overflow
I have an array of individual characters, that I am using to map out a string. However, the whitespace is being ignored. How...
Read more >HTML white space entities  /  not rendered correctly
It seems the svelte compiler removes if it is not accompanied by additional non-whitespace characters within the same textnode. you ...
Read more >How whitespace is handled by HTML, CSS, and in the DOM
Most whitespace characters are ignored, not all of them are. In the earlier example ... still exists when the page is rendered in...
Read more >White space automatically removed when rendering
In the attached workflow when i try to render a table with one record with the sentence: This is a doubly spaced sentence....
Read more >White-space processing in XAML - Microsoft Learn
Consistent with XML, white-space characters in XAML are space, linefeed, ... between each ListBoxItem) is not preserved and not rendered.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
.replace(/>\s</g, ‘>­ <’) 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.