-
-
Notifications
You must be signed in to change notification settings - Fork 7
Render HTML into native view #18
-
ReactNative has got an awesome plugin to render simple HTML into native view:
https://github.com/archriss/react-native-render-html
Is there any possibility to get any thing similar in NS8? I guess we still can use HtmlView but wanted to have something more advanced.
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
Replies: 3 comments 1 reply
-
I really like this feature "Custom HTML tags": https://github.com/meliorence/react-native-render-html#creating-custom-renderers
Beta Was this translation helpful? Give feedback.
All reactions
-
I guess to achieve this you would need some sort of html parser (ie: https://www.npmjs.com/package/node-html-parser) and then a way to map each html tag to a nativescript component.
Beta Was this translation helpful? Give feedback.
All reactions
This comment was marked as disruptive content.
This comment was marked as disruptive content.
-
Hi @NathanaelA,
I think the OP is looking for a better nativescript <htmlView> element (https://docs.nativescript.org/ui/components/html-view). A bit like the react-native-render-html plugin.
I mentioned the "custom html tags" feature because it allows the user to fully customise how a particular html tag should be rendered.
For example:
<h1>Hello world</h1> could be mapped to <Label class="h1" text="text.value" />.
<img src="my-image.jpg" /> could be mapped to <MyImageCacheComponent ratio="16:9" src="src.value" />.
I don't think this is particularly hard to do if I ever needed to build something like this, but it would be convenient to have this incorporated into <htmlView> or a similarly named component.
For me personally, <htmlView> has never been customisable enough for me to ever be able to use it in a project.
Beta Was this translation helpful? Give feedback.