Updated docs for next

This commit is contained in:
Website Deployment Script
2016-06-06 03:02:53 +00:00
parent 8c17425bf4
commit 7790387d73
+8 -3
View File
@@ -7,7 +7,12 @@ access and handle it from any component you want with</p><div class="prism langu
<span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token keyword">catch</span><span class="token punctuation">(</span>err <span class="token operator">=</span><span class="token operator">&gt;</span> console<span class="token punctuation">.</span><span class="token function">error<span class="token punctuation">(</span></span><span class="token string">&#x27;An error occurred&#x27;</span><span class="token punctuation">,</span> err<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span></div><p>NOTE: For instructions on how to add support for deep linking on Android,
refer to <a href="http://developer.android.com/training/app-indexing/deep-linking.html#adding-filters" target="_blank">Enabling Deep Links for App Content - Add Intent Filters for Your Deep Links</a>.</p><p>NOTE: On iOS you&#x27;ll need to link <code>RCTLinking</code> to your project by following
refer to <a href="http://developer.android.com/training/app-indexing/deep-linking.html#adding-filters" target="_blank">Enabling Deep Links for App Content - Add Intent Filters for Your Deep Links</a>.</p><p>If you wish to receive the intent in an existing instance of MainActivity,
you may set the <code>launchMode</code> of MainActivity to <code>singleTask</code> in
<code>AndroidManifest.xml</code>. See <a href="http://developer.android.com/guide/topics/manifest/activity-element.html" target="_blank"><code>&lt;activity&gt;</code></a>
documentation for more information.</p><div class="prism language-javascript">&lt;activity
android<span class="token punctuation">:</span>name<span class="token operator">=</span><span class="token string">&quot;.MainActivity&quot;</span>
android<span class="token punctuation">:</span>launchMode<span class="token operator">=</span><span class="token string">&quot;singleTask&quot;</span><span class="token operator">&gt;</span></div><p>NOTE: On iOS you&#x27;ll need to link <code>RCTLinking</code> to your project by following
the steps described <a href="docs/linking-libraries-ios.html#manual-linking" target="_blank">here</a>.
In case you also want to listen to incoming app links during your app&#x27;s
execution you&#x27;ll need to add the following lines to you <code>*AppDelegate.m</code>:</p><div class="prism language-javascript">#import <span class="token string">&quot;RCTLinkingManager.h&quot;</span>
@@ -35,14 +40,14 @@ execution you&#x27;ll need to add the following lines to you <code>*AppDelegate.
<span class="token punctuation">}</span><span class="token punctuation">,</span>
<span class="token function">_handleOpenURL<span class="token punctuation">(</span></span>event<span class="token punctuation">)</span> <span class="token punctuation">{</span>
console<span class="token punctuation">.</span><span class="token function">log<span class="token punctuation">(</span></span>event<span class="token punctuation">.</span>url<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span></div><p>Note that this is only supported on iOS.</p><h4><a class="anchor" name="opening-external-links"></a>Opening external links <a class="hash-link" href="docs/linking.html#opening-external-links">#</a></h4><p>To start the corresponding activity for a link (web URL, email, contact etc.), call</p><div class="prism language-javascript">Linking<span class="token punctuation">.</span><span class="token function">openURL<span class="token punctuation">(</span></span>url<span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token keyword">catch</span><span class="token punctuation">(</span>err <span class="token operator">=</span><span class="token operator">&gt;</span> console<span class="token punctuation">.</span><span class="token function">error<span class="token punctuation">(</span></span><span class="token string">&#x27;An error occurred&#x27;</span><span class="token punctuation">,</span> err<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span></div><p>If you want to check if any installed app can handle a given URL beforehand you can call</p><div class="prism language-javascript">Linking<span class="token punctuation">.</span><span class="token function">canOpenURL<span class="token punctuation">(</span></span>url<span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">then<span class="token punctuation">(</span></span>supported <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
<span class="token punctuation">}</span></div><h4><a class="anchor" name="opening-external-links"></a>Opening external links <a class="hash-link" href="docs/linking.html#opening-external-links">#</a></h4><p>To start the corresponding activity for a link (web URL, email, contact etc.), call</p><div class="prism language-javascript">Linking<span class="token punctuation">.</span><span class="token function">openURL<span class="token punctuation">(</span></span>url<span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token keyword">catch</span><span class="token punctuation">(</span>err <span class="token operator">=</span><span class="token operator">&gt;</span> console<span class="token punctuation">.</span><span class="token function">error<span class="token punctuation">(</span></span><span class="token string">&#x27;An error occurred&#x27;</span><span class="token punctuation">,</span> err<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span></div><p>If you want to check if any installed app can handle a given URL beforehand you can call</p><div class="prism language-javascript">Linking<span class="token punctuation">.</span><span class="token function">canOpenURL<span class="token punctuation">(</span></span>url<span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">then<span class="token punctuation">(</span></span>supported <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
<span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span>supported<span class="token punctuation">)</span> <span class="token punctuation">{</span>
console<span class="token punctuation">.</span><span class="token function">log<span class="token punctuation">(</span></span><span class="token string">&#x27;Can\&#x27;t handle url: &#x27;</span> <span class="token operator">+</span> url<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span> <span class="token keyword">else</span> <span class="token punctuation">{</span>
<span class="token keyword">return</span> Linking<span class="token punctuation">.</span><span class="token function">openURL<span class="token punctuation">(</span></span>url<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token keyword">catch</span><span class="token punctuation">(</span>err <span class="token operator">=</span><span class="token operator">&gt;</span> console<span class="token punctuation">.</span><span class="token function">error<span class="token punctuation">(</span></span><span class="token string">&#x27;An error occurred&#x27;</span><span class="token punctuation">,</span> err<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span></div></div><span><h3><a class="anchor" name="methods"></a>Methods <a class="hash-link" href="docs/linking.html#methods">#</a></h3><div class="props"><div class="prop"><h4 class="propTitle"><a class="anchor" name="constructor"></a>constructor<span class="propType">()</span> <a class="hash-link" href="docs/linking.html#constructor">#</a></h4></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="addeventlistener"></a>addEventListener<span class="propType">(type, handler)</span> <a class="hash-link" href="docs/linking.html#addeventlistener">#</a></h4><div><p>Add a handler to Linking changes by listening to the <code>url</code> event type
and providing the handler</p><p>@platform ios</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="removeeventlistener"></a>removeEventListener<span class="propType">(type, handler)</span> <a class="hash-link" href="docs/linking.html#removeeventlistener">#</a></h4><div><p>Remove a handler by passing the <code>url</code> event type and the handler</p><p>@platform ios</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="openurl"></a>openURL<span class="propType">(url)</span> <a class="hash-link" href="docs/linking.html#openurl">#</a></h4><div><p>Try to open the given <code>url</code> with any of the installed apps.</p><p>You can use other URLs, like a location (e.g. &quot;geo:37.484847,-122.148386&quot;), a contact,
and providing the handler</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="removeeventlistener"></a>removeEventListener<span class="propType">(type, handler)</span> <a class="hash-link" href="docs/linking.html#removeeventlistener">#</a></h4><div><p>Remove a handler by passing the <code>url</code> event type and the handler</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="openurl"></a>openURL<span class="propType">(url)</span> <a class="hash-link" href="docs/linking.html#openurl">#</a></h4><div><p>Try to open the given <code>url</code> with any of the installed apps.</p><p>You can use other URLs, like a location (e.g. &quot;geo:37.484847,-122.148386&quot;), a contact,
or any other URL that can be opened with the installed apps.</p><p>NOTE: This method will fail if the system doesn&#x27;t know how to open the specified URL.
If you&#x27;re passing in a non-http(s) URL, it&#x27;s best to check {@code canOpenURL} first.</p><p>NOTE: For web URLs, the protocol (&quot;http://&quot;, &quot;https://&quot;) must be set accordingly!</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="canopenurl"></a>canOpenURL<span class="propType">(url)</span> <a class="hash-link" href="docs/linking.html#canopenurl">#</a></h4><div><p>Determine whether or not an installed app can handle a given URL.</p><p>NOTE: For web URLs, the protocol (&quot;http://&quot;, &quot;https://&quot;) must be set accordingly!</p><p>NOTE: As of iOS 9, your app needs to provide the <code>LSApplicationQueriesSchemes</code> key
inside <code>Info.plist</code> or canOpenURL will always return false.</p><p>@param URL the URL to open</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="getinitialurl"></a>getInitialURL<span class="propType">()</span> <a class="hash-link" href="docs/linking.html#getinitialurl">#</a></h4><div><p>If the app launch was triggered by an app link,