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

elementModel.isTranslatableTextual is not a function. #556

Closed hanhtv204 closed 2 years ago

hanhtv204 commented 2 years ago

Decision Table

Good Faith Declaration

Description

In my html, I have use iframe. I got this warning and my iframe was not displayed. The "iframe" tag is a valid HTML element but is not handled by this library. You must extend the default HTMLElementModel for this tag with "customHTMLElementModels" prop and make sure its content model is not set to "none". If you don't want this tag to be rendered, add it to "ignoredDomTags" prop array.

As warning above, I added prop like this and got error

elementModel.isTranslatableTextual is not a function.

customHTMLElementModels={{
iframe: {
tagName: 'iframe',
contentModel: HTMLContentModel.block,
},
}}

Is there anyone met this issue? Thank you

React Native Information

"react": "17.0.2",
"react-native": "0.66.4",

RNRH Version

"react-native-render-html": "^6.3.4",

Tested Platforms

Reproduction Platforms

Minimal, Reproducible Example

Above information

Additional Notes

No response

jsamr commented 2 years ago

@hanhtv204 Are you using Typescript or JavaScript? If you are using TS, isn't this code snippet causing a type error? To render iframes, use this plugin: https://github.com/native-html/plugins/tree/master/packages/iframe-plugin#readme

hanhtv204 commented 2 years ago

@hanhtv204 Are you using Typescript or JavaScript? If you are using TS, isn't this code snippet causing a type error? To render iframes, use this plugin: https://github.com/native-html/plugins/tree/master/packages/iframe-plugin#readme

I use Javascript @jsamr

jsamr commented 2 years ago

@hanhtv204 All right; to use customHTMLElementModels, you should take inspiration from this guide: https://meliorence.github.io/react-native-render-html/docs/guides/custom-renderers#example-registering-a-new-tag I am going to close now; if you need to render iframes, just use the plugin I mentioned.