Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any component/API in React Native to handle Email and Phone Number links

LinkingIOS says the following:
* The iOS simulator does not support the mailto: and tel: schemas * because the Mail and Phone apps are not installed - you will need to test * them on a device.

What can I use in my React Native app to link to the native Mail app when an email address is clicked on? And similarly, how do I give the option to call or text-message when a telephone number is clicked on?

like image 446
rahul2001 Avatar asked Dec 24 '22 19:12

rahul2001


1 Answers

You can use the LinkingIOS.openURL(url). It will work perfect on actual iPhone. You cannot test it on Simulator because those apps are not available on simulator. So, use mailto: for email, tel: for call & sms: for sending SMS.

I would also recommend you doing feature detection using LinkingIOS.canOpenURL because, iPad will also not support the call and sms features. So its always good idea to check the support for the url scheme before using it.

like image 102
Mayank Patel Avatar answered Dec 31 '22 03:12

Mayank Patel