mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-03-28 22:46:52 +08:00
Update LinkingIOS.js
This commit is contained in:
@@ -22,15 +22,15 @@ var _initialURL = RCTLinkingManager &&
|
||||
var DEVICE_NOTIF_EVENT = 'openURL';
|
||||
|
||||
/**
|
||||
* `LinkingIOS` gives you a general interface to interact with both, incoming
|
||||
* and outgoing app links.
|
||||
* `LinkingIOS` gives you an interface to interact with both incoming and
|
||||
* outgoing app links.
|
||||
*
|
||||
* ### Basic Usage
|
||||
*
|
||||
* #### Handling deep links
|
||||
*
|
||||
* If your app was launched from a external url registered to your app you can
|
||||
* access and handle it from any component you want with
|
||||
* If your app was launched from an external URL registered with your app, you can
|
||||
* access and handle it from any component you want with the following:
|
||||
*
|
||||
* ```
|
||||
* componentDidMount() {
|
||||
@@ -39,7 +39,7 @@ var DEVICE_NOTIF_EVENT = 'openURL';
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* In case you also want to listen to incoming app links during your app's
|
||||
* If 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`:
|
||||
*
|
||||
* ```
|
||||
@@ -48,7 +48,7 @@ var DEVICE_NOTIF_EVENT = 'openURL';
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* And then on your React component you'll be able to listen to the events on
|
||||
* And in your React component, you'll then be able to listen to the events from
|
||||
* `LinkingIOS` as follows
|
||||
*
|
||||
* ```
|
||||
@@ -65,13 +65,14 @@ var DEVICE_NOTIF_EVENT = 'openURL';
|
||||
*
|
||||
* #### Triggering App links
|
||||
*
|
||||
* To trigger an app link (browser, email or custom schemas) you call
|
||||
* To trigger an app link (browser, email, or custom schemes) you can call:
|
||||
*
|
||||
* ```
|
||||
* LinkingIOS.openURL(url)
|
||||
* ```
|
||||
*
|
||||
* If you want to check if any installed app can handle a given url beforehand you can call
|
||||
* If you want to check if a URL can be opened by an installed app on the system you can call
|
||||
*
|
||||
* ```
|
||||
* LinkingIOS.canOpenURL(url, (supported) => {
|
||||
* if (!supported) {
|
||||
@@ -117,6 +118,8 @@ class LinkingIOS {
|
||||
|
||||
/**
|
||||
* Try to open the given `url` with any of the installed apps.
|
||||
* If multiple applications can open `url`, the one that opens
|
||||
* is undefined.
|
||||
*/
|
||||
static openURL(url: string) {
|
||||
invariant(
|
||||
@@ -127,7 +130,7 @@ class LinkingIOS {
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine wether or not the an installed app can handle a given `url`
|
||||
* Determine whether an installed app can handle a given `url`.
|
||||
* The callback function will be called with `bool supported` as the only argument
|
||||
*/
|
||||
static canOpenURL(url: string, callback: Function) {
|
||||
@@ -143,7 +146,7 @@ class LinkingIOS {
|
||||
}
|
||||
|
||||
/**
|
||||
* If the app launch was triggered by an app link, it will pop the link url,
|
||||
* If the app launch was triggered by an app link, it will pop the link URL,
|
||||
* otherwise it will return `null`
|
||||
*/
|
||||
static popInitialURL(): ?string {
|
||||
|
||||
Reference in New Issue
Block a user