Files
react-native/docs/0.7/custom-webview-android.html
T
Sophie Alpert 7529d09f2e Revert "Deploy website"
This reverts commit 30b387cc5d.
2018-06-26 14:47:34 -07:00

238 lines
26 KiB
HTML

<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Custom WebView · React Native</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="While the built-in web view has a lot of features, it is not possible to handle every use-case in React Native. You can, however, extend the web view with native code without forking React Native or duplicating all the existing web view code."/><meta name="docsearch:version" content="0.7"/><meta name="docsearch:language" content="en"/><meta property="og:title" content="Custom WebView · React Native"/><meta property="og:type" content="website"/><meta property="og:url" content="https://facebook.github.io/react-native/index.html"/><meta property="og:description" content="While the built-in web view has a lot of features, it is not possible to handle every use-case in React Native. You can, however, extend the web view with native code without forking React Native or duplicating all the existing web view code."/><meta name="twitter:card" content="summary"/><link rel="shortcut icon" href="/react-native/img/favicon.png"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css"/><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/solarized-dark.min.css"/><link rel="alternate" type="application/atom+xml" href="https://facebook.github.io/react-native/blog/atom.xml" title="React Native Blog ATOM Feed"/><link rel="alternate" type="application/rss+xml" href="https://facebook.github.io/react-native/blog/feed.xml" title="React Native Blog RSS Feed"/><script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-41298772-2', 'auto');
ga('send', 'pageview');
</script><script type="text/javascript" src="https://snack.expo.io/embed.js"></script><script type="text/javascript" src="/react-native/js/codeblocks.js"></script><link rel="stylesheet" href="/react-native/css/main.css"/></head><body class="sideNavVisible"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/react-native/"><img class="logo" src="/react-native/img/header_logo.png" alt="React Native"/><h2 class="headerTitleWithLogo">React Native</h2></a><a href="/react-native/versions"><h3>0.7</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-site-internal"><li class=""><a href="/react-native/docs/0.7/getting-started" target="_self">Docs</a></li><li class=""><a href="/react-native/en/help" target="_self">Community</a></li><li class=""><a href="/react-native/blog" target="_self">Blog</a></li><li class="navSearchWrapper reactNavSearchWrapper"><input type="text" id="search_input_react" placeholder="Search" title="Search"/></li><li class=""><a href="https://github.com/facebook/react-native" target="_self">GitHub</a></li><li class=""><a href="https://reactjs.org/" target="_self">React</a></li></ul></nav></div></header></div></div><div class="navPusher"><div class="docMainWrapper wrapper"><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/facebook/react-native-website/blob/master/docs/custom-webview-android.md" target="_blank" rel="noreferrer noopener">Edit</a><h1 class="postHeaderTitle">Custom WebView</h1></header><article><div><span><p>While the built-in web view has a lot of features, it is not possible to handle every use-case in React Native. You can, however, extend the web view with native code without forking React Native or duplicating all the existing web view code.</p>
<p>Before you do this, you should be familiar with the concepts in <a href="native-components-android">native UI components</a>. You should also familiarise yourself with the <a href="https://github.com/facebook/react-native/blob/master/ReactAndroid/src/main/java/com/facebook/react/views/webview/ReactWebViewManager.java">native code for web views</a>, as you will have to use this as a reference when implementing new features—although a deep understanding is not required.</p>
<h2><a class="anchor" aria-hidden="true" id="native-code"></a><a href="#native-code" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Native Code</h2>
<p>To get started, you'll need to create a subclass of <code>ReactWebViewManager</code>, <code>ReactWebView</code>, and <code>ReactWebViewClient</code>. In your view manager, you'll then need to override:</p>
<ul>
<li><code>createReactWebViewInstance</code></li>
<li><code>getName</code></li>
<li><code>addEventEmitters</code></li>
</ul>
<pre><code class="hljs css languages- java"><span class="hljs-meta">@ReactModule</span>(name = CustomWebViewManager.REACT_CLASS)
<span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">CustomWebViewManager</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">ReactWebViewManager</span> </span>{
<span class="hljs-comment">/* This name must match what we're referring to in JS */</span>
<span class="hljs-keyword">protected</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">final</span> String REACT_CLASS = <span class="hljs-string">"RCTCustomWebView"</span>;
<span class="hljs-keyword">protected</span> <span class="hljs-keyword">static</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">CustomWebViewClient</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">ReactWebViewClient</span> </span>{ }
<span class="hljs-keyword">protected</span> <span class="hljs-keyword">static</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">CustomWebView</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">ReactWebView</span> </span>{
<span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-title">CustomWebView</span><span class="hljs-params">(ThemedReactContext reactContext)</span> </span>{
<span class="hljs-keyword">super</span>(reactContext);
}
}
<span class="hljs-meta">@Override</span>
<span class="hljs-function"><span class="hljs-keyword">protected</span> ReactWebView <span class="hljs-title">createReactWebViewInstance</span><span class="hljs-params">(ThemedReactContext reactContext)</span> </span>{
<span class="hljs-keyword">return</span> <span class="hljs-keyword">new</span> CustomWebView(reactContext);
}
<span class="hljs-meta">@Override</span>
<span class="hljs-function"><span class="hljs-keyword">public</span> String <span class="hljs-title">getName</span><span class="hljs-params">()</span> </span>{
<span class="hljs-keyword">return</span> REACT_CLASS;
}
<span class="hljs-meta">@Override</span>
<span class="hljs-function"><span class="hljs-keyword">protected</span> <span class="hljs-keyword">void</span> <span class="hljs-title">addEventEmitters</span><span class="hljs-params">(ThemedReactContext reactContext, WebView view)</span> </span>{
view.setWebViewClient(<span class="hljs-keyword">new</span> CustomWebViewClient());
}
}
</code></pre>
<p>You'll need to follow the usual steps to <a href="/react-native/docs/0.7/native-modules-android#register-the-module">register the module</a>.</p>
<h3><a class="anchor" aria-hidden="true" id="adding-new-properties"></a><a href="#adding-new-properties" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Adding New Properties</h3>
<p>To add a new property, you'll need to add it to <code>CustomWebView</code>, and then expose it in <code>CustomWebViewManager</code>.</p>
<pre><code class="hljs css languages- java"><span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">CustomWebViewManager</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">ReactWebViewManager</span> </span>{
...
<span class="hljs-keyword">protected</span> <span class="hljs-keyword">static</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">CustomWebView</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">ReactWebView</span> </span>{
<span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-title">CustomWebView</span><span class="hljs-params">(ThemedReactContext reactContext)</span> </span>{
<span class="hljs-keyword">super</span>(reactContext);
}
<span class="hljs-keyword">protected</span> <span class="hljs-meta">@Nullable</span> String mFinalUrl;
<span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">setFinalUrl</span><span class="hljs-params">(String url)</span> </span>{
mFinalUrl = url;
}
<span class="hljs-function"><span class="hljs-keyword">public</span> String <span class="hljs-title">getFinalUrl</span><span class="hljs-params">()</span> </span>{
<span class="hljs-keyword">return</span> mFinalUrl;
}
}
...
<span class="hljs-meta">@ReactProp</span>(name = <span class="hljs-string">"finalUrl"</span>)
<span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">setFinalUrl</span><span class="hljs-params">(WebView view, String url)</span> </span>{
((CustomWebView) view).setFinalUrl(url);
}
}
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="adding-new-events"></a><a href="#adding-new-events" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Adding New Events</h3>
<p>For events, you'll first need to make create event subclass.</p>
<pre><code class="hljs css languages- java"><span class="hljs-comment">// NavigationCompletedEvent.java</span>
<span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">NavigationCompletedEvent</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">Event</span>&lt;<span class="hljs-title">NavigationCompletedEvent</span>&gt; </span>{
<span class="hljs-keyword">private</span> WritableMap mParams;
<span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-title">NavigationCompletedEvent</span><span class="hljs-params">(<span class="hljs-keyword">int</span> viewTag, WritableMap params)</span> </span>{
<span class="hljs-keyword">super</span>(viewTag);
<span class="hljs-keyword">this</span>.mParams = params;
}
<span class="hljs-meta">@Override</span>
<span class="hljs-function"><span class="hljs-keyword">public</span> String <span class="hljs-title">getEventName</span><span class="hljs-params">()</span> </span>{
<span class="hljs-keyword">return</span> <span class="hljs-string">"navigationCompleted"</span>;
}
<span class="hljs-meta">@Override</span>
<span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">dispatch</span><span class="hljs-params">(RCTEventEmitter rctEventEmitter)</span> </span>{
init(getViewTag());
rctEventEmitter.receiveEvent(getViewTag(), getEventName(), mParams);
}
}
</code></pre>
<p>You can trigger the event in your web view client. You can hook existing handlers if your events are based on them.</p>
<p>You should refer to <a href="https://github.com/facebook/react-native/blob/master/ReactAndroid/src/main/java/com/facebook/react/views/webview/ReactWebViewManager.java">ReactWebViewManager.java</a> in the React Native codebase to see what handlers are available and how they are implemented. You can extend any methods here to provide extra functionality.</p>
<pre><code class="hljs css languages- java"><span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">NavigationCompletedEvent</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">Event</span>&lt;<span class="hljs-title">NavigationCompletedEvent</span>&gt; </span>{
<span class="hljs-keyword">private</span> WritableMap mParams;
<span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-title">NavigationCompletedEvent</span><span class="hljs-params">(<span class="hljs-keyword">int</span> viewTag, WritableMap params)</span> </span>{
<span class="hljs-keyword">super</span>(viewTag);
<span class="hljs-keyword">this</span>.mParams = params;
}
<span class="hljs-meta">@Override</span>
<span class="hljs-function"><span class="hljs-keyword">public</span> String <span class="hljs-title">getEventName</span><span class="hljs-params">()</span> </span>{
<span class="hljs-keyword">return</span> <span class="hljs-string">"navigationCompleted"</span>;
}
<span class="hljs-meta">@Override</span>
<span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">dispatch</span><span class="hljs-params">(RCTEventEmitter rctEventEmitter)</span> </span>{
init(getViewTag());
rctEventEmitter.receiveEvent(getViewTag(), getEventName(), mParams);
}
}
<span class="hljs-comment">// CustomWebViewManager.java</span>
<span class="hljs-keyword">protected</span> <span class="hljs-keyword">static</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">CustomWebViewClient</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">ReactWebViewClient</span> </span>{
<span class="hljs-meta">@Override</span>
<span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">boolean</span> <span class="hljs-title">shouldOverrideUrlLoading</span><span class="hljs-params">(WebView view, String url)</span> </span>{
<span class="hljs-keyword">boolean</span> shouldOverride = <span class="hljs-keyword">super</span>.shouldOverrideUrlLoading(view, url);
String finalUrl = ((CustomWebView) view).getFinalUrl();
<span class="hljs-keyword">if</span> (!shouldOverride &amp;&amp; url != <span class="hljs-keyword">null</span> &amp;&amp; finalUrl != <span class="hljs-keyword">null</span> &amp;&amp; <span class="hljs-keyword">new</span> String(url).equals(finalUrl)) {
<span class="hljs-keyword">final</span> WritableMap params = Arguments.createMap();
dispatchEvent(view, <span class="hljs-keyword">new</span> NavigationCompletedEvent(view.getId(), params));
}
<span class="hljs-keyword">return</span> shouldOverride;
}
}
</code></pre>
<p>Finally, you'll need to expose the events in <code>CustomWebViewManager</code> through <code>getExportedCustomDirectEventTypeConstants</code>. Note that currently, the default implementation returns <code>null</code>, but this may change in the future.</p>
<pre><code class="hljs css languages- java"><span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">CustomWebViewManager</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">ReactWebViewManager</span> </span>{
...
<span class="hljs-meta">@Override</span>
<span class="hljs-keyword">public</span> <span class="hljs-meta">@Nullable</span>
<span class="hljs-function">Map <span class="hljs-title">getExportedCustomDirectEventTypeConstants</span><span class="hljs-params">()</span> </span>{
Map&lt;String, Object&gt; export = <span class="hljs-keyword">super</span>.getExportedCustomDirectEventTypeConstants();
<span class="hljs-keyword">if</span> (export == <span class="hljs-keyword">null</span>) {
export = MapBuilder.newHashMap();
}
export.put(<span class="hljs-string">"navigationCompleted"</span>, MapBuilder.of(<span class="hljs-string">"registrationName"</span>, <span class="hljs-string">"onNavigationCompleted"</span>));
<span class="hljs-keyword">return</span> export;
}
}
</code></pre>
<h2><a class="anchor" aria-hidden="true" id="javascript-interface"></a><a href="#javascript-interface" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>JavaScript Interface</h2>
<p>To use your custom web view, you'll need to create a class for it. Your class must:</p>
<ul>
<li>Export all the prop types from <code>WebView.propTypes</code></li>
<li>Return a <code>WebView</code> component with the prop <code>nativeConfig.component</code> set to your native component (see below)</li>
</ul>
<p>To get your native component, you must use <code>requireNativeComponent</code>: the same as for regular custom components. However, you must pass in an extra third argument, <code>WebView.extraNativeComponentConfig</code>. This third argument contains prop types that are only required for native code.</p>
<pre><code class="hljs css languages- javascript"><span class="hljs-keyword">import</span> React, {Component, PropTypes} <span class="hljs-keyword">from</span> <span class="hljs-string">'react'</span>;
<span class="hljs-keyword">import</span> {WebView, requireNativeComponent} <span class="hljs-keyword">from</span> <span class="hljs-string">'react-native'</span>;
<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">CustomWebView</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">Component</span> </span>{
<span class="hljs-keyword">static</span> propTypes = WebView.propTypes;
render() {
<span class="hljs-keyword">return</span> (
<span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">WebView</span> {<span class="hljs-attr">...this.props</span>} <span class="hljs-attr">nativeConfig</span>=<span class="hljs-string">{{component:</span> <span class="hljs-attr">RCTCustomWebView</span>}} /&gt;</span>
);
}
}
const RCTCustomWebView = requireNativeComponent(
'RCTCustomWebView',
CustomWebView,
WebView.extraNativeComponentConfig
);
</span></code></pre>
<p>If you want to add custom props to your native component, you can use <code>nativeConfig.props</code> on the web view.</p>
<p>For events, the event handler must always be set to a function. This means it isn't safe to use the event handler directly from <code>this.props</code>, as the user might not have provided one. The standard approach is to create a event handler in your class, and then invoking the event handler given in <code>this.props</code> if it exists.</p>
<p>If you are unsure how something should be implemented from the JS side, look at <a href="https://github.com/facebook/react-native/blob/master/Libraries/Components/WebView/WebView.android.js">WebView.android.js</a> in the React Native source.</p>
<pre><code class="hljs css languages- javascript"><span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">CustomWebView</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">Component</span> </span>{
<span class="hljs-keyword">static</span> propTypes = {
...WebView.propTypes,
<span class="hljs-attr">finalUrl</span>: PropTypes.string,
<span class="hljs-attr">onNavigationCompleted</span>: PropTypes.func,
};
<span class="hljs-keyword">static</span> defaultProps = {
<span class="hljs-attr">finalUrl</span>: <span class="hljs-string">'about:blank'</span>,
};
_onNavigationCompleted = <span class="hljs-function">(<span class="hljs-params">event</span>) =&gt;</span> {
<span class="hljs-keyword">const</span> {onNavigationCompleted} = <span class="hljs-keyword">this</span>.props;
onNavigationCompleted &amp;&amp; onNavigationCompleted(event);
};
render() {
<span class="hljs-keyword">return</span> (
<span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">WebView</span>
{<span class="hljs-attr">...this.props</span>}
<span class="hljs-attr">nativeConfig</span>=<span class="hljs-string">{{</span>
<span class="hljs-attr">component:</span> <span class="hljs-attr">RCTCustomWebView</span>,
<span class="hljs-attr">props:</span> {
<span class="hljs-attr">finalUrl:</span> <span class="hljs-attr">this.props.finalUrl</span>,
<span class="hljs-attr">onNavigationCompleted:</span> <span class="hljs-attr">this._onNavigationCompleted</span>,
},
}}
/&gt;</span>
);
}
}
</span></code></pre>
<p>Just like for regular native components, you must provide all your prop types in the component to have them forwarded on to the native component. However, if you have some prop types that are only used internally in component, you can add them to the <code>nativeOnly</code> property of the third argument previously mentioned. For event handlers, you have to use the value <code>true</code> instead of a regular prop type.</p>
<p>For example, if you wanted to add an internal event handler called <code>onScrollToBottom</code>, you would use,</p>
<pre><code class="hljs css languages- javascript"><span class="hljs-keyword">const</span> RCTCustomWebView = requireNativeComponent(
<span class="hljs-string">'RCTCustomWebView'</span>,
CustomWebView,
{
...WebView.extraNativeComponentConfig,
<span class="hljs-attr">nativeOnly</span>: {
...WebView.extraNativeComponentConfig.nativeOnly,
<span class="hljs-attr">onScrollToBottom</span>: <span class="hljs-literal">true</span>,
},
}
);
</code></pre>
</span></div></article></div><div class="docs-prevnext"></div></div></div></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/react-native/" class="nav-home"><img src="/react-native/img/header_logo.png" alt="React Native" width="66" height="58"/></a><div><h5><a href="/react-native/docs/getting-started.html">Docs</a></h5><a href="/react-native/docs/getting-started.html">Getting Started</a><a href="/react-native/docs/tutorial.html">Tutorial</a><a href="/react-native/docs/components-and-apis.html">Components and APIs</a><a href="/react-native/docs/more-resources.html">More Resources</a></div><div><h5><a href="/react-native/help.html">Community</a></h5><a href="/react-native/showcase.html">Who&#x27;s using React Native?</a><a href="http://stackoverflow.com/questions/tagged/react-native" target="_blank">Stack Overflow</a><a href="https://discuss.reactjs.org" target="_blank">Discussion Forum</a><a href="https://discord.gg/0ZcbPKXt5bZjGY5n">Reactiflux Chat</a></div><div><h5>More</h5><a href="/react-native/blog">Blog</a><a href="https://twitter.com/reactnative" target="_blank">Twitter</a><a href="https://github.com/facebook/react-native" target="_blank">GitHub</a><a href="http://reactjs.org" target="_blank">React</a></div></section><a href="https://code.facebook.com/projects/" target="_blank" class="fbOpenSource"><img src="/react-native/img/oss_logo.png" alt="Facebook Open Source" width="170" height="45"/></a><section class="copyright">Copyright © 2018 Facebook Inc.</section></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>window.fbAsyncInit = function() {FB.init({appId:'1677033832619985',xfbml:true,version:'v2.7'});};(function(d, s, id){var js, fjs = d.getElementsByTagName(s)[0];if (d.getElementById(id)) {return;}js = d.createElement(s); js.id = id;js.src = '//connect.facebook.net/en_US/sdk.js';fjs.parentNode.insertBefore(js, fjs);}(document, 'script','facebook-jssdk'));
</script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter-wjs'));</script><script>
var search = docsearch({
apiKey: '2c98749b4a1e588efec53b2acec13025',
indexName: 'react-native-versions',
inputSelector: '#search_input_react',
algoliaOptions: {"facetFilters":["tags:0.7"],"hitsPerPage":5}
});
</script></body></html>