React-native-render-html: Special href: tel and mailto

Created on 8 May 2018  路  1Comment  路  Source: meliorence/react-native-render-html

Hi all
How should I create the tel: and mailto: href attributes in order to work?

I am using the standard, but nothing happens on tap:

<a href="tel:+1-303-499-7111">+1 (303) 499-7111</a>
<a href="mailto:[email protected]?subject=Contact_subject&amp;body=Hi">Contact</a>

Thanks

question

Most helpful comment

Ok, it was easy:

I imported Linking and added onLinkPress={(evt, href) => { Linking.openURL(href) }}

        <HTML
          html={this.state.text}
          imagesMaxWidth={Dimensions.get('window').width - 40}
          onLinkPress={(evt, href) => { Linking.openURL(href) }}
        />

Just in case it helps someone else.

>All comments

Ok, it was easy:

I imported Linking and added onLinkPress={(evt, href) => { Linking.openURL(href) }}

        <HTML
          html={this.state.text}
          imagesMaxWidth={Dimensions.get('window').width - 40}
          onLinkPress={(evt, href) => { Linking.openURL(href) }}
        />

Just in case it helps someone else.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

duansiyu picture duansiyu  路  4Comments

f-roland picture f-roland  路  3Comments

chadmorrow picture chadmorrow  路  7Comments

jamesawer3 picture jamesawer3  路  3Comments

kikoseijo picture kikoseijo  路  6Comments