Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Render HTML into native view #18

darko-bw started this conversation in 1. Ideas & Discussions
Dec 12, 2020 · 3 comments · 1 reply
Discussion options

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.

You must be logged in to vote

Replies: 3 comments · 1 reply

Comment options

I really like this feature "Custom HTML tags": https://github.com/meliorence/react-native-render-html#creating-custom-renderers

You must be logged in to vote
0 replies
Comment options

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.

You must be logged in to vote
0 replies

This comment was marked as disruptive content.

@7ammer
Comment options

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.