To open a link call openURL.
Linking.openURL(url)
.catch(err => console.error('An error occurred ', err))
The preferred method is to check if any installed app can handle a given URL beforehand.
Linking.canOpenURL(url)
.then(supported => {
if (!supported) {
console.log('Unsupported URL: ' + url)
} else {
return Linking.openURL(url)
}
}).catch(err => console.error('An error occurred ', err))
Target App | Example | Reference |
---|---|---|
Web Browser | https://stackoverflow.com | |
Phone | tel:1-408-555-5555 | Apple |
mailto:[email protected] | Apple | |
SMS | sms:1-408-555-1212 | Apple |
Apple Maps | http://maps.apple.com/?ll=37.484847,-122.148386 | Apple |
Google Maps | geo:37.7749,-122.4194 | |
iTunes | See iTunes Link Maker | Apple |
fb://profile | Stack Overflow | |
YouTube | http://www.youtube.com/v/oHg5SJYRHA0 | Apple |
Facetime | facetime://[email protected] | Apple |
iOS Calendar | calshow:514300000 [1] | iPhoneDevWiki |
[1] Opens the calendar at the stated number of seconds since 1. 1. 2001 (UTC?). For some reason this API is undocumented by Apple.