meliorence / react-native-render-html

iOS/Android pure javascript react-native component that renders your HTML into 100% native views
https://meliorence.github.io/react-native-render-html/
BSD 2-Clause "Simplified" License
3.48k stars 589 forks source link

not render HTML like —   etc... #525

Closed ppatel31 closed 3 years ago

ppatel31 commented 3 years ago

Decision Table

Good Faith Declaration

Description

not render HTML like —   etc...

React Native Information

not render HTML like —   etc...

RNRH Version

not render HTML like —   etc...

Tested Platforms

Reproduction Platforms

Minimal, Reproducible Example

not render HTML like —   etc...

Additional Notes

not render HTML like —   etc...

jsamr commented 3 years ago

Hi @ppatel31, and thank you for your submission. Unfortunately, you didn't provide mandatory fields with useful information and there is not much I can do from the little information you gave. Are you expecting to see HTML entities (&mdash ...etc) rendered in their UTF-8 equivalent? Or you'd like not to render these entities in their UTF-8 equivalent? This is not obvious from your title. Entities (&mdash ...etc) are decoded to UTF-8 by htmlparser2 in the DOM parsing phase. You can chose to enable / disable entities parsing with htmlParserOptions={{ decodeEntities: false }} prop. This should be true by default. I'm closing now, but if you wish to share any extraneous information, please do.

hanzoow commented 3 years ago

hi @jsamr , i have content HTML like this: <div>d wq d</div><div>qw</div><div>&nbsp;d</div><div>wq d</div><div>q&nbsp;</div><div>d</div>

I want break line as html like. when i use htmlParserOptions={{ decodeEntities: false }} prop, it show &nbsp; in UI but i dont want it to be shown. Otherwise, if i use decodeEntities: true, app crash with message is: Cannot read properties of undefined (reading '0') and track file like image below. image

How can i let it break line without crash ?

jsamr commented 3 years ago

@hanzoow please fill a bug report with a full reproduction and I'll be happy to help you out :-)