diff --git a/releases/next/docs/linking.html b/releases/next/docs/linking.html index 9080775823e..fd9af280c35 100644 --- a/releases/next/docs/linking.html +++ b/releases/next/docs/linking.html @@ -7,7 +7,12 @@ access and handle it from any component you want with

} }).catch(err => console.error('An error occurred', err)); }

NOTE: For instructions on how to add support for deep linking on Android, -refer to Enabling Deep Links for App Content - Add Intent Filters for Your Deep Links.

NOTE: On iOS you'll need to link RCTLinking to your project by following +refer to Enabling Deep Links for App Content - Add Intent Filters for Your Deep Links.

If you wish to receive the intent in an existing instance of MainActivity, +you may set the launchMode of MainActivity to singleTask in +AndroidManifest.xml. See <activity> +documentation for more information.

<activity + android:name=".MainActivity" + android:launchMode="singleTask">

NOTE: On iOS you'll need to link RCTLinking to your project by following the steps described here. In case you also want to listen to incoming app links during your app's execution you'll need to add the following lines to you *AppDelegate.m:

#import "RCTLinkingManager.h" @@ -35,14 +40,14 @@ execution you'll need to add the following lines to you *AppDelegate. }, _handleOpenURL(event) { console.log(event.url); -}

Note that this is only supported on iOS.

Opening external links #

To start the corresponding activity for a link (web URL, email, contact etc.), call

Linking.openURL(url).catch(err => console.error('An error occurred', err));

If you want to check if any installed app can handle a given URL beforehand you can call

Linking.canOpenURL(url).then(supported => { +}

Opening external links #

To start the corresponding activity for a link (web URL, email, contact etc.), call

Linking.openURL(url).catch(err => console.error('An error occurred', err));

If you want to check if any installed app can handle a given URL beforehand you can call

Linking.canOpenURL(url).then(supported => { if (!supported) { console.log('Can\'t handle url: ' + url); } else { return Linking.openURL(url); } }).catch(err => console.error('An error occurred', err));

Methods #

constructor() #

addEventListener(type, handler) #

Add a handler to Linking changes by listening to the url event type -and providing the handler

@platform ios

removeEventListener(type, handler) #

Remove a handler by passing the url event type and the handler

@platform ios

openURL(url) #

Try to open the given url with any of the installed apps.

You can use other URLs, like a location (e.g. "geo:37.484847,-122.148386"), a contact, +and providing the handler

removeEventListener(type, handler) #

Remove a handler by passing the url event type and the handler

openURL(url) #

Try to open the given url with any of the installed apps.

You can use other URLs, like a location (e.g. "geo:37.484847,-122.148386"), a contact, or any other URL that can be opened with the installed apps.

NOTE: This method will fail if the system doesn't know how to open the specified URL. If you're passing in a non-http(s) URL, it's best to check {@code canOpenURL} first.

NOTE: For web URLs, the protocol ("http://", "https://") must be set accordingly!

canOpenURL(url) #

Determine whether or not an installed app can handle a given URL.

NOTE: For web URLs, the protocol ("http://", "https://") must be set accordingly!

NOTE: As of iOS 9, your app needs to provide the LSApplicationQueriesSchemes key inside Info.plist or canOpenURL will always return false.

@param URL the URL to open

getInitialURL() #

If the app launch was triggered by an app link,