React-native-render-html: onLinkPress needs to be clearly documented.

Created on 2 Oct 2018  路  11Comments  路  Source: meliorence/react-native-render-html

Can I make a suggestion:

On your docs Page there should be a section about onLinkPress that reads something like |

To enable the user to press a link, the LINKING library must be IMPORTED at the top of your code, as well as this line must appear in the HTML call statement like so:

        <HTML
          html={this.content}
          onLinkPress={(event, href)=>{
            Linking.openURL(href)
          }}
        />
documentation FAQ candidate meta

Most helpful comment

Excelent.
One question: how could you get the link text, besides the href attribute? The text is valuable info too.

<a href="...">This here</a>

All 11 comments

@magicmiles thank you.

I have troubles with this ...
Seems not works with the app is make with Expo :(

@davidcort It's doing fine with expo but you must import Linking from expo not react-native
Example: import { Linking } from 'expo'

this post saved my morning. Thanks @magicmiles

Saved my bacon by providing this, THANK YOU!!! Worked awesome for phone linking too by providing the tel: in the href before the number.

Thanks for your example! Really help me.

Excelent.
One question: how could you get the link text, besides the href attribute? The text is valuable info too.

<a href="...">This here</a>

Excelent.
One question: how could you get the link text, besides the href attribute? The text is valuable info too.

<a href="...">This here</a>

Any Update on this?

You're a legend @davidcort

If you import Linking from react-native, it's work like a charm.

In react-native-render-html v5.0.0, onLinkPress defaults to a function invoking Linking.openURL, so there won't be a need for documenting this! See #442

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kanikas24 picture kanikas24  路  5Comments

psegalen picture psegalen  路  7Comments

Pradeet picture Pradeet  路  7Comments

sayem314 picture sayem314  路  6Comments

jamesawer3 picture jamesawer3  路  3Comments