react-native-render-html icon indicating copy to clipboard operation
react-native-render-html copied to clipboard

onLinkPress needs to be clearly documented.

Open magicmiles opened this issue 8 years ago • 11 comments

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)
          }}
        />

magicmiles avatar Oct 02 '18 15:10 magicmiles

@magicmiles thank you.

erhanbicer avatar Nov 08 '18 21:11 erhanbicer

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

davidcort avatar Jan 22 '19 23:01 davidcort

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

abzeede avatar Feb 16 '19 10:02 abzeede

this post saved my morning. Thanks @magicmiles

intransitorio avatar May 17 '19 17:05 intransitorio

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

code-jenn-or avatar May 20 '19 15:05 code-jenn-or

Thanks for your example! Really help me.

ghost avatar Oct 31 '19 06:10 ghost

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>

guille-alibrate avatar Jan 16 '20 21:01 guille-alibrate

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?

Yab-kami avatar Apr 25 '20 11:04 Yab-kami

You're a legend @davidcort

Akira-25 avatar Jul 14 '20 03:07 Akira-25

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

Fred-Reis avatar Jul 16 '20 14:07 Fred-Reis

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

jsamr avatar Dec 05 '20 17:12 jsamr