Files
react-native/docs/webview/index.html
T
2021-02-01 14:39:14 +00:00

47 lines
58 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="generator" content="Docusaurus v2.0.0-alpha.66">
<link rel="alternate" type="application/rss+xml" href="/blog/rss.xml" title="React Native Blog RSS Feed">
<link rel="alternate" type="application/atom+xml" href="/blog/atom.xml" title="React Native Blog Atom Feed">
<link rel="preconnect" href="https://www.google-analytics.com">
<script>window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)},ga.l=+new Date,ga("create","UA-41298772-2","auto"),ga("send","pageview")</script>
<script async src="https://www.google-analytics.com/analytics.js"></script>
<link rel="preconnect" href="https://www.google-analytics.com">
<link rel="preconnect" href="https://www.googletagmanager.com">
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-41298772-2"></script>
<script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","UA-41298772-2",{})</script>
<link rel="search" type="application/opensearchdescription+xml" title="React Native" href="/opensearch.xml">
<script src="https://cdn.jsdelivr.net/npm/focus-visible@5.2.0/dist/focus-visible.min.js" defer="defer"></script>
<script src="https://snack.expo.io/embed.js" defer="defer"></script><title data-react-helmet="true">🚧 WebView · React Native</title><meta data-react-helmet="true" property="twitter:image" content="https://reactnative.dev/img/logo-og.png"><meta data-react-helmet="true" name="twitter:image:alt" content="Image for React Native"><meta data-react-helmet="true" name="docsearch:language" content="en"><meta data-react-helmet="true" name="docsearch:version" content="0.63"><meta data-react-helmet="true" name="docsearch:docusaurus_tag" content="docs-default-0.63"><meta data-react-helmet="true" property="og:image" content="https://reactnative.dev/img/logo-og.png"><meta data-react-helmet="true" name="twitter:card" content="summary"><meta data-react-helmet="true" name="twitter:image" content="https://reactnative.dev/img/logo-og.png"><meta data-react-helmet="true" property="og:title" content="🚧 WebView · React Native"><meta data-react-helmet="true" name="description" content="Deprecated. Use react-native-community/react-native-webview instead."><meta data-react-helmet="true" property="og:description" content="Deprecated. Use react-native-community/react-native-webview instead."><meta data-react-helmet="true" property="og:url" content="https://reactnative.dev/docs/webview"><link data-react-helmet="true" rel="shortcut icon" href="/img/favicon.ico"><link data-react-helmet="true" rel="preconnect" href="https://BH4D9OD16A-dsn.algolia.net" crossorigin="anonymous"><link data-react-helmet="true" rel="canonical" href="https://reactnative.dev/docs/webview"><link rel="stylesheet" href="/styles.fccefeba.css">
<link rel="stylesheet" href="/main.ca40cabd.css">
<link rel="preload" href="/styles.07d522c6.js" as="script">
<link rel="preload" href="/runtime~main.579b1f59.js" as="script">
<link rel="preload" href="/main.5e05a427.js" as="script">
<link rel="preload" href="/1.ba9ce8bd.js" as="script">
<link rel="preload" href="/2.58cb5d3d.js" as="script">
<link rel="preload" href="/1f391b9e.a824c215.js" as="script">
<link rel="preload" href="/943.8b024446.js" as="script">
<link rel="preload" href="/ee5b3385.b4fff665.js" as="script">
<link rel="preload" href="/17896441.0c201679.js" as="script">
<link rel="preload" href="/3d8443ce.fb4d5926.js" as="script">
</head>
<body>
<script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus">
<nav class="navbar navbar--fixed-top navbar--dark"><div class="navbar__inner"><div class="navbar__items"><div aria-label="Navigation bar toggle" class="navbar__toggle" role="button" tabindex="0"><svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 30 30" role="img" focusable="false"><title>Menu</title><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></div><a class="navbar__brand" href="/"><img class="navbar__logo" src="/img/header_logo.svg" alt="React Native"><strong class="navbar__title">React Native</strong></a><div class="navbar__item dropdown dropdown--hoverable dropdown--left"><a class="navbar__item navbar__link" href="/docs/getting-started">0.63</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/docs/next/getting-started">Next</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/docs/webview">0.63</a></li><li><a class="dropdown__link" href="/docs/0.62/webview">0.62</a></li><li><a class="dropdown__link" href="/docs/0.61/webview">0.61</a></li><li><a class="dropdown__link" href="/docs/0.60/webview">0.60</a></li><li><a class="dropdown__link" href="/versions">All versions</a></li></ul></div></div><div class="navbar__items navbar__items--right"><a class="navbar__item navbar__link" href="/docs/getting-started">Docs</a><a class="navbar__item navbar__link" href="/docs/components-and-apis">Components</a><a class="navbar__item navbar__link" href="/docs/accessibilityinfo">API</a><a class="navbar__item navbar__link" href="/help">Community</a><a class="navbar__item navbar__link" href="/blog">Blog</a><a href="https://github.com/facebook/react-native" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link navbar-github-link" aria-label="GitHub repository"></a><div class="react-toggle react-toggle--disabled displayOnlyInLargeViewport_3lWe"><div class="react-toggle-track"><div class="react-toggle-track-check"><span class="toggle_gnXW">🌜</span></div><div class="react-toggle-track-x"><span class="toggle_gnXW">🌞</span></div></div><div class="react-toggle-thumb"></div><input type="checkbox" disabled="" aria-label="Dark mode toggle" class="react-toggle-screenreader-only"></div><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span><span class="DocSearch-Button-Key"></span><span class="DocSearch-Button-Key">K</span></button></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div><div class="navbar-sidebar"><div class="navbar-sidebar__brand"><a class="navbar__brand" href="/"><img class="navbar__logo" src="/img/header_logo.svg" alt="React Native"><strong class="navbar__title">React Native</strong></a></div><div class="navbar-sidebar__items"><div class="menu"><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" href="/docs/getting-started">Docs</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/components-and-apis">Components</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/accessibilityinfo">API</a></li><li class="menu__list-item"><a class="menu__link" href="/help">Community</a></li><li class="menu__list-item"><a class="menu__link" href="/blog">Blog</a></li><li class="menu__list-item"><a role="button" class="menu__link menu__link--sublist">Versions</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" href="/docs/next/getting-started">Next</a></li><li class="menu__list-item"><a aria-current="page" class="menu__link menu__link--active" href="/docs/webview">0.63</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/0.62/webview">0.62</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/0.61/webview">0.61</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/0.60/webview">0.60</a></li><li class="menu__list-item"><a class="menu__link" href="/versions">All versions</a></li></ul></li><li class="menu__list-item"><a href="https://github.com/facebook/react-native" target="_blank" rel="noopener noreferrer" class="menu__link navbar-github-link" aria-label="GitHub repository"></a></li></ul></div></div></div></nav><div class="main-wrapper"><div class="docPage_2UBv"><main class="docMainContainer_1rYT"><div class="container padding-vert--lg docItemWrapper_1Hme"><div class="row"><div class="col docItemCol_2AGf"><div class="docItemContainer_1tAC"><article><header><h1 class="docTitle_cWlf">🚧 WebView</h1></header><div class="markdown"><blockquote><p><strong>Deprecated.</strong> Use <a href="https://github.com/react-native-community/react-native-webview" target="_blank" rel="noopener noreferrer">react-native-community/react-native-webview</a> instead.</p></blockquote><p><code>WebView</code> renders web content in a native view.</p><div class="mdxCodeBlock_xYIz"><div class="codeBlockContent_rlEb"><button tabindex="0" type="button" aria-label="Copy code to clipboard" class="copyButton_kOW4">Copy</button><div class="prism-code language-jsx codeBlock_1AP7"><div class="codeBlockLines_1boI" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token keyword" style="color:#c5a5c5">import</span><span class="token plain"> React</span><span class="token punctuation" style="color:#657b83">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#657b83">{</span><span class="token plain"> Component </span><span class="token punctuation" style="color:#657b83">}</span><span class="token plain"> </span><span class="token keyword" style="color:#c5a5c5">from</span><span class="token plain"> </span><span class="token string" style="color:#8dc891">&#x27;react&#x27;</span><span class="token punctuation" style="color:#657b83">;</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"></span><span class="token keyword" style="color:#c5a5c5">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#657b83">{</span><span class="token plain"> WebView </span><span class="token punctuation" style="color:#657b83">}</span><span class="token plain"> </span><span class="token keyword" style="color:#c5a5c5">from</span><span class="token plain"> </span><span class="token string" style="color:#8dc891">&#x27;react-native&#x27;</span><span class="token punctuation" style="color:#657b83">;</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"></span><span class="token keyword" style="color:#c5a5c5">class</span><span class="token plain"> </span><span class="token class-name" style="color:#fac863">MyWeb</span><span class="token plain"> </span><span class="token keyword" style="color:#c5a5c5">extends</span><span class="token plain"> </span><span class="token class-name" style="color:#fac863">Component</span><span class="token plain"> </span><span class="token punctuation" style="color:#657b83">{</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> </span><span class="token function" style="color:#79b6f2">render</span><span class="token punctuation" style="color:#657b83">(</span><span class="token punctuation" style="color:#657b83">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#657b83">{</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> </span><span class="token keyword" style="color:#c5a5c5">return</span><span class="token plain"> </span><span class="token punctuation" style="color:#657b83">(</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> </span><span class="token tag punctuation" style="color:#657b83">&lt;</span><span class="token tag class-name" style="color:#fac863">WebView</span><span class="token tag" style="color:#fc929e"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token tag" style="color:#fc929e"> </span><span class="token tag attr-name" style="color:#c5a5c5">source</span><span class="token tag script language-javascript script-punctuation punctuation" style="color:#657b83">=</span><span class="token tag script language-javascript punctuation" style="color:#657b83">{</span><span class="token tag script language-javascript punctuation" style="color:#657b83">{</span><span class="token tag script language-javascript" style="color:#fc929e"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token tag script language-javascript" style="color:#fc929e"> uri</span><span class="token tag script language-javascript punctuation" style="color:#657b83">:</span><span class="token tag script language-javascript" style="color:#fc929e"> </span><span class="token tag script language-javascript string" style="color:#8dc891">&#x27;https://github.com/facebook/react-native&#x27;</span><span class="token tag script language-javascript" style="color:#fc929e"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token tag script language-javascript" style="color:#fc929e"> </span><span class="token tag script language-javascript punctuation" style="color:#657b83">}</span><span class="token tag script language-javascript punctuation" style="color:#657b83">}</span><span class="token tag" style="color:#fc929e"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token tag" style="color:#fc929e"> </span><span class="token tag attr-name" style="color:#c5a5c5">style</span><span class="token tag script language-javascript script-punctuation punctuation" style="color:#657b83">=</span><span class="token tag script language-javascript punctuation" style="color:#657b83">{</span><span class="token tag script language-javascript punctuation" style="color:#657b83">{</span><span class="token tag script language-javascript" style="color:#fc929e"> marginTop</span><span class="token tag script language-javascript punctuation" style="color:#657b83">:</span><span class="token tag script language-javascript" style="color:#fc929e"> </span><span class="token tag script language-javascript number" style="color:#5a9bcf">20</span><span class="token tag script language-javascript" style="color:#fc929e"> </span><span class="token tag script language-javascript punctuation" style="color:#657b83">}</span><span class="token tag script language-javascript punctuation" style="color:#657b83">}</span><span class="token tag" style="color:#fc929e"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token tag" style="color:#fc929e"> </span><span class="token tag punctuation" style="color:#657b83">/&gt;</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> </span><span class="token punctuation" style="color:#657b83">)</span><span class="token punctuation" style="color:#657b83">;</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> </span><span class="token punctuation" style="color:#657b83">}</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"></span><span class="token punctuation" style="color:#657b83">}</span></div></div></div></div></div><p>Minimal example with inline HTML:</p><div class="mdxCodeBlock_xYIz"><div class="codeBlockContent_rlEb"><button tabindex="0" type="button" aria-label="Copy code to clipboard" class="copyButton_kOW4">Copy</button><div class="prism-code language-jsx codeBlock_1AP7"><div class="codeBlockLines_1boI" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token keyword" style="color:#c5a5c5">import</span><span class="token plain"> React</span><span class="token punctuation" style="color:#657b83">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#657b83">{</span><span class="token plain"> Component </span><span class="token punctuation" style="color:#657b83">}</span><span class="token plain"> </span><span class="token keyword" style="color:#c5a5c5">from</span><span class="token plain"> </span><span class="token string" style="color:#8dc891">&#x27;react&#x27;</span><span class="token punctuation" style="color:#657b83">;</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"></span><span class="token keyword" style="color:#c5a5c5">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#657b83">{</span><span class="token plain"> WebView </span><span class="token punctuation" style="color:#657b83">}</span><span class="token plain"> </span><span class="token keyword" style="color:#c5a5c5">from</span><span class="token plain"> </span><span class="token string" style="color:#8dc891">&#x27;react-native&#x27;</span><span class="token punctuation" style="color:#657b83">;</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"></span><span class="token keyword" style="color:#c5a5c5">class</span><span class="token plain"> </span><span class="token class-name" style="color:#fac863">MyInlineWeb</span><span class="token plain"> </span><span class="token keyword" style="color:#c5a5c5">extends</span><span class="token plain"> </span><span class="token class-name" style="color:#fac863">Component</span><span class="token plain"> </span><span class="token punctuation" style="color:#657b83">{</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> </span><span class="token function" style="color:#79b6f2">render</span><span class="token punctuation" style="color:#657b83">(</span><span class="token punctuation" style="color:#657b83">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#657b83">{</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> </span><span class="token keyword" style="color:#c5a5c5">return</span><span class="token plain"> </span><span class="token punctuation" style="color:#657b83">(</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> </span><span class="token tag punctuation" style="color:#657b83">&lt;</span><span class="token tag class-name" style="color:#fac863">WebView</span><span class="token tag" style="color:#fc929e"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token tag" style="color:#fc929e"> </span><span class="token tag attr-name" style="color:#c5a5c5">originWhitelist</span><span class="token tag script language-javascript script-punctuation punctuation" style="color:#657b83">=</span><span class="token tag script language-javascript punctuation" style="color:#657b83">{</span><span class="token tag script language-javascript punctuation" style="color:#657b83">[</span><span class="token tag script language-javascript string" style="color:#8dc891">&#x27;*&#x27;</span><span class="token tag script language-javascript punctuation" style="color:#657b83">]</span><span class="token tag script language-javascript punctuation" style="color:#657b83">}</span><span class="token tag" style="color:#fc929e"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token tag" style="color:#fc929e"> </span><span class="token tag attr-name" style="color:#c5a5c5">source</span><span class="token tag script language-javascript script-punctuation punctuation" style="color:#657b83">=</span><span class="token tag script language-javascript punctuation" style="color:#657b83">{</span><span class="token tag script language-javascript punctuation" style="color:#657b83">{</span><span class="token tag script language-javascript" style="color:#fc929e"> html</span><span class="token tag script language-javascript punctuation" style="color:#657b83">:</span><span class="token tag script language-javascript" style="color:#fc929e"> </span><span class="token tag script language-javascript string" style="color:#8dc891">&#x27;&lt;h1&gt;Hello world&lt;/h1&gt;&#x27;</span><span class="token tag script language-javascript" style="color:#fc929e"> </span><span class="token tag script language-javascript punctuation" style="color:#657b83">}</span><span class="token tag script language-javascript punctuation" style="color:#657b83">}</span><span class="token tag" style="color:#fc929e"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token tag" style="color:#fc929e"> </span><span class="token tag punctuation" style="color:#657b83">/&gt;</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> </span><span class="token punctuation" style="color:#657b83">)</span><span class="token punctuation" style="color:#657b83">;</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> </span><span class="token punctuation" style="color:#657b83">}</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"></span><span class="token punctuation" style="color:#657b83">}</span></div></div></div></div></div><p>You can use this component to navigate back and forth in the web view&#x27;s history and configure various properties for the web content.</p><p>On iOS, the <code>useWebKit</code> prop can be used to opt into a WKWebView-backed implementation.</p><blockquote><p><strong>Security Warning:</strong> Currently, <code>onMessage</code> and <code>postMessage</code> do not allow specifying an origin. This can lead to cross-site scripting attacks if an unexpected document is loaded within a <code>WebView</code> instance. Please refer to the MDN documentation for <a href="https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage" target="_blank" rel="noopener noreferrer"><code>Window.postMessage()</code></a> for more details on the security implications of this.</p></blockquote><hr><h1><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="reference"></a>Reference<a aria-hidden="true" tabindex="-1" class="hash-link" href="#reference" title="Direct link to heading">#</a></h1><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="props"></a>Props<a aria-hidden="true" tabindex="-1" class="hash-link" href="#props" title="Direct link to heading">#</a></h2><p>Inherits <a href="/docs/view#props">View Props</a>.</p><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="source"></a><code>source</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#source" title="Direct link to heading">#</a></h3><p>Loads static HTML or a URI (with optional headers) in the WebView. Note that static HTML will require setting <a href="/docs/webview#originwhitelist"><code>originWhitelist</code></a> to <code>[&quot;*&quot;]</code>.</p><p>The object passed to <code>source</code> can have either of the following shapes:</p><p><strong>Load uri</strong></p><ul><li><code>uri</code> (string) - The URI to load in the <code>WebView</code>. Can be a local or remote file.</li><li><code>method</code> (string) - The HTTP Method to use. Defaults to GET if not specified. On Android, the only supported methods are GET and POST.</li><li><code>headers</code> (object) - Additional HTTP headers to send with the request. On Android, this can only be used with GET requests.</li><li><code>body</code> (string) - The HTTP body to send with the request. This must be a valid UTF-8 string, and will be sent exactly as specified, with no additional encoding (e.g. URL-escaping or base64) applied. On Android, this can only be used with POST requests.</li></ul><p><strong>Static HTML</strong></p><ul><li><code>html</code> (string) - A static HTML page to display in the WebView.</li><li><code>baseUrl</code> (string) - The base URL to be used for any relative links in the HTML.</li></ul><table><thead><tr><th>Type</th><th>Required</th></tr></thead><tbody><tr><td>object</td><td>No</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="automaticallyadjustcontentinsets"></a><code>automaticallyAdjustContentInsets</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#automaticallyadjustcontentinsets" title="Direct link to heading">#</a></h3><p>Controls whether to adjust the content inset for web views that are placed behind a navigation bar, tab bar, or toolbar. The default value is <code>true</code>.</p><table><thead><tr><th>Type</th><th>Required</th></tr></thead><tbody><tr><td>bool</td><td>No</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="injectjavascript"></a><code>injectJavaScript</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#injectjavascript" title="Direct link to heading">#</a></h3><p>Function that accepts a string that will be passed to the WebView and executed immediately as JavaScript.</p><table><thead><tr><th>Type</th><th>Required</th></tr></thead><tbody><tr><td>function</td><td>No</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="injectedjavascript"></a><code>injectedJavaScript</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#injectedjavascript" title="Direct link to heading">#</a></h3><p>Set this to provide JavaScript that will be injected into the web page when the view loads.</p><table><thead><tr><th>Type</th><th>Required</th></tr></thead><tbody><tr><td>string</td><td>No</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="mediaplaybackrequiresuseraction"></a><code>mediaPlaybackRequiresUserAction</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#mediaplaybackrequiresuseraction" title="Direct link to heading">#</a></h3><p>Boolean that determines whether HTML5 audio and video requires the user to tap them before they start playing. The default value is <code>true</code>.</p><table><thead><tr><th>Type</th><th>Required</th></tr></thead><tbody><tr><td>bool</td><td>No</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="nativeconfig"></a><code>nativeConfig</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#nativeconfig" title="Direct link to heading">#</a></h3><p>Override the native component used to render the WebView. Enables a custom native WebView which uses the same JavaScript as the original WebView.</p><p>The <code>nativeConfig</code> prop expects an object with the following keys:</p><ul><li><code>component</code> (any)</li><li><code>props</code> (object)</li><li><code>viewManager</code> (object)</li></ul><table><thead><tr><th>Type</th><th>Required</th></tr></thead><tbody><tr><td>object</td><td>No</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="onerror"></a><code>onError</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#onerror" title="Direct link to heading">#</a></h3><p>Function that is invoked when the <code>WebView</code> load fails.</p><table><thead><tr><th>Type</th><th>Required</th></tr></thead><tbody><tr><td>function</td><td>No</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="onload"></a><code>onLoad</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#onload" title="Direct link to heading">#</a></h3><p>Function that is invoked when the <code>WebView</code> has finished loading.</p><table><thead><tr><th>Type</th><th>Required</th></tr></thead><tbody><tr><td>function</td><td>No</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="onloadend"></a><code>onLoadEnd</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#onloadend" title="Direct link to heading">#</a></h3><p>Function that is invoked when the <code>WebView</code> load succeeds or fails.</p><table><thead><tr><th>Type</th><th>Required</th></tr></thead><tbody><tr><td>function</td><td>No</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="onloadstart"></a><code>onLoadStart</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#onloadstart" title="Direct link to heading">#</a></h3><p>Function that is invoked when the <code>WebView</code> starts loading.</p><table><thead><tr><th>Type</th><th>Required</th></tr></thead><tbody><tr><td>function</td><td>No</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="onmessage"></a><code>onMessage</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#onmessage" title="Direct link to heading">#</a></h3><p>A function that is invoked when the webview calls <code>window.postMessage</code>. Setting this property will inject a <code>postMessage</code> global into your webview, but will still call pre-existing values of <code>postMessage</code>.</p><p><code>window.postMessage</code> accepts one argument, <code>data</code>, which will be available on the event object, <code>event.nativeEvent.data</code>. <code>data</code> must be a string.</p><table><thead><tr><th>Type</th><th>Required</th></tr></thead><tbody><tr><td>function</td><td>No</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="onnavigationstatechange"></a><code>onNavigationStateChange</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#onnavigationstatechange" title="Direct link to heading">#</a></h3><p>Function that is invoked when the <code>WebView</code> loading starts or ends.</p><table><thead><tr><th>Type</th><th>Required</th></tr></thead><tbody><tr><td>function</td><td>No</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="originwhitelist"></a><code>originWhitelist</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#originwhitelist" title="Direct link to heading">#</a></h3><p>List of origin strings to allow being navigated to. The strings allow wildcards and get matched against <em>only</em> the origin (not the full URL). If the user taps to navigate to a new page but the new page is not in this safelist, the URL will be handled by the OS. The default safelistlisted origins are <code>&quot;http://*&quot;</code> and <code>&quot;https://*&quot;</code>.</p><table><thead><tr><th>Type</th><th>Required</th></tr></thead><tbody><tr><td>array of strings</td><td>No</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="rendererror"></a><code>renderError</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#rendererror" title="Direct link to heading">#</a></h3><p>Function that returns a view to show if there&#x27;s an error.</p><table><thead><tr><th>Type</th><th>Required</th></tr></thead><tbody><tr><td>function</td><td>No</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="renderloading"></a><code>renderLoading</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#renderloading" title="Direct link to heading">#</a></h3><p>Function that returns a loading indicator. The startInLoadingState prop must be set to true in order to use this prop.</p><table><thead><tr><th>Type</th><th>Required</th></tr></thead><tbody><tr><td>function</td><td>No</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="scalespagetofit"></a><code>scalesPageToFit</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#scalespagetofit" title="Direct link to heading">#</a></h3><p>Boolean that controls whether the web content is scaled to fit the view and enables the user to change the scale. The default value is <code>true</code>.</p><p>On iOS, when <a href="/docs/webview#usewebkit"><code>useWebKit=true</code></a>, this prop will not work.</p><table><thead><tr><th>Type</th><th>Required</th></tr></thead><tbody><tr><td>bool</td><td>No</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="onshouldstartloadwithrequest"></a><code>onShouldStartLoadWithRequest</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#onshouldstartloadwithrequest" title="Direct link to heading">#</a></h3><p>Function that allows custom handling of any web view requests. Return <code>true</code> from the function to continue loading the request and <code>false</code> to stop loading.</p><table><thead><tr><th>Type</th><th>Required</th><th>Platform</th></tr></thead><tbody><tr><td>function</td><td>No</td><td>iOS</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="startinloadingstate"></a><code>startInLoadingState</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#startinloadingstate" title="Direct link to heading">#</a></h3><p>Boolean value that forces the <code>WebView</code> to show the loading view on the first load. This prop must be set to <code>true</code> in order for the <code>renderLoading</code> prop to work.</p><table><thead><tr><th>Type</th><th>Required</th></tr></thead><tbody><tr><td>bool</td><td>No</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="decelerationrate"></a><code>decelerationRate</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#decelerationrate" title="Direct link to heading">#</a></h3><p>A floating-point number that determines how quickly the scroll view decelerates after the user lifts their finger. You may also use the string shortcuts <code>&quot;normal&quot;</code> and <code>&quot;fast&quot;</code> which match the underlying iOS settings for <code>UIScrollViewDecelerationRateNormal</code> and <code>UIScrollViewDecelerationRateFast</code> respectively:</p><ul><li>normal: 0.998</li><li>fast: 0.99 (the default for iOS web view)</li></ul><table><thead><tr><th>Type</th><th>Required</th><th>Platform</th></tr></thead><tbody><tr><td>number</td><td>No</td><td>iOS</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="domstorageenabled"></a><code>domStorageEnabled</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#domstorageenabled" title="Direct link to heading">#</a></h3><p>Boolean value to control whether DOM Storage is enabled. Used only in Android.</p><table><thead><tr><th>Type</th><th>Required</th><th>Platform</th></tr></thead><tbody><tr><td>bool</td><td>No</td><td>Android</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="javascriptenabled"></a><code>javaScriptEnabled</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#javascriptenabled" title="Direct link to heading">#</a></h3><p>Boolean value to enable JavaScript in the <code>WebView</code>. Used on Android only as JavaScript is enabled by default on iOS. The default value is <code>true</code>.</p><table><thead><tr><th>Type</th><th>Required</th><th>Platform</th></tr></thead><tbody><tr><td>bool</td><td>No</td><td>Android</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="mixedcontentmode"></a><code>mixedContentMode</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#mixedcontentmode" title="Direct link to heading">#</a></h3><p>Specifies the mixed content mode. i.e WebView will allow a secure origin to load content from any other origin.</p><p>Possible values for <code>mixedContentMode</code> are:</p><ul><li><code>never</code> (default) - WebView will not allow a secure origin to load content from an insecure origin.</li><li><code>always</code> - WebView will allow a secure origin to load content from any other origin, even if that origin is insecure.</li><li><code>compatibility</code> - WebView will attempt to be compatible with the approach of a modern web browser with regard to mixed content.</li></ul><table><thead><tr><th>Type</th><th>Required</th><th>Platform</th></tr></thead><tbody><tr><td>string</td><td>No</td><td>Android</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="thirdpartycookiesenabled"></a><code>thirdPartyCookiesEnabled</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#thirdpartycookiesenabled" title="Direct link to heading">#</a></h3><p>Boolean value to enable third party cookies in the <code>WebView</code>. Used on Android Lollipop and above only as third party cookies are enabled by default on Android Kitkat and below and on iOS. The default value is <code>true</code>.</p><table><thead><tr><th>Type</th><th>Required</th><th>Platform</th></tr></thead><tbody><tr><td>bool</td><td>No</td><td>Android</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="useragent"></a><code>userAgent</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#useragent" title="Direct link to heading">#</a></h3><p>Sets the user-agent for the <code>WebView</code>.</p><table><thead><tr><th>Type</th><th>Required</th><th>Platform</th></tr></thead><tbody><tr><td>string</td><td>No</td><td>Android</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="allowsinlinemediaplayback"></a><code>allowsInlineMediaPlayback</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#allowsinlinemediaplayback" title="Direct link to heading">#</a></h3><p>Boolean that determines whether HTML5 videos play inline or use the native full-screen controller. The default value is <code>false</code>.</p><blockquote><p><strong>NOTE</strong></p><p>In order for video to play inline, not only does this property need to be set to <code>true</code>, but the video element in the HTML document must also include the <code>webkit-playsinline</code> attribute.</p></blockquote><table><thead><tr><th>Type</th><th>Required</th><th>Platform</th></tr></thead><tbody><tr><td>bool</td><td>No</td><td>iOS</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="bounces"></a><code>bounces</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#bounces" title="Direct link to heading">#</a></h3><p>Boolean value that determines whether the web view bounces when it reaches the edge of the content. The default value is <code>true</code>.</p><table><thead><tr><th>Type</th><th>Required</th><th>Platform</th></tr></thead><tbody><tr><td>bool</td><td>No</td><td>iOS</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="contentinset"></a><code>contentInset</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#contentinset" title="Direct link to heading">#</a></h3><p>The amount by which the web view content is inset from the edges of the scroll view. Defaults to {top: 0, left: 0, bottom: 0, right: 0}.</p><table><thead><tr><th>Type</th><th>Required</th><th>Platform</th></tr></thead><tbody><tr><td>object: {top: number, left: number, bottom: number, right: number}</td><td>No</td><td>iOS</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="datadetectortypes"></a><code>dataDetectorTypes</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#datadetectortypes" title="Direct link to heading">#</a></h3><p>Determines the types of data converted to clickable URLs in the web view&#x27;s content. By default only phone numbers are detected.</p><p>You can provide one type or an array of many types.</p><p>Possible values for <code>dataDetectorTypes</code> are:</p><ul><li><code>phoneNumber</code></li><li><code>link</code></li><li><code>address</code></li><li><code>calendarEvent</code></li><li><code>none</code></li><li><code>all</code></li></ul><p>With the <a href="/docs/webview#usewebkit">new WebKit</a> implementation, we have three new values:</p><ul><li><code>trackingNumber</code></li><li><code>flightNumber</code></li><li><code>lookupSuggestion</code></li></ul><table><thead><tr><th>Type</th><th>Required</th><th>Platform</th></tr></thead><tbody><tr><td>string, or array</td><td>No</td><td>iOS</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="scrollenabled"></a><code>scrollEnabled</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#scrollenabled" title="Direct link to heading">#</a></h3><p>Boolean value that determines whether scrolling is enabled in the <code>WebView</code>. The default value is <code>true</code>.</p><table><thead><tr><th>Type</th><th>Required</th><th>Platform</th></tr></thead><tbody><tr><td>bool</td><td>No</td><td>iOS</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="geolocationenabled"></a><code>geolocationEnabled</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#geolocationenabled" title="Direct link to heading">#</a></h3><p>Set whether Geolocation is enabled in the <code>WebView</code>. The default value is <code>false</code>. Used only in Android.</p><table><thead><tr><th>Type</th><th>Required</th><th>Platform</th></tr></thead><tbody><tr><td>bool</td><td>No</td><td>Android</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="allowuniversalaccessfromfileurls"></a><code>allowUniversalAccessFromFileURLs</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#allowuniversalaccessfromfileurls" title="Direct link to heading">#</a></h3><p>Boolean that sets whether JavaScript running in the context of a file scheme URL should be allowed to access content from any origin. Including accessing content from other file scheme URLs. The default value is <code>false</code>.</p><table><thead><tr><th>Type</th><th>Required</th><th>Platform</th></tr></thead><tbody><tr><td>bool</td><td>No</td><td>Android</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="allowfileaccess"></a><code>allowFileAccess</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#allowfileaccess" title="Direct link to heading">#</a></h3><p>Boolean that sets whether the <code>WebView</code> has access to the file system. The default value is <code>false</code>.</p><table><thead><tr><th>Type</th><th>Required</th><th>Platform</th></tr></thead><tbody><tr><td>bool</td><td>No</td><td>Android</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="usewebkit"></a><code>useWebKit</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#usewebkit" title="Direct link to heading">#</a></h3><p>If true, use WKWebView instead of UIWebView.</p><table><thead><tr><th>Type</th><th>Required</th><th>Platform</th></tr></thead><tbody><tr><td>boolean</td><td>No</td><td>iOS</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="url"></a><code>url</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#url" title="Direct link to heading">#</a></h3><p><strong>Deprecated.</strong> Use the <code>source</code> prop instead.</p><table><thead><tr><th>Type</th><th>Required</th></tr></thead><tbody><tr><td>string</td><td>No</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="html"></a><code>html</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#html" title="Direct link to heading">#</a></h3><p><strong>Deprecated.</strong> Use the <code>source</code> prop instead.</p><table><thead><tr><th>Type</th><th>Required</th></tr></thead><tbody><tr><td>string</td><td>No</td></tr></tbody></table><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="methods"></a>Methods<a aria-hidden="true" tabindex="-1" class="hash-link" href="#methods" title="Direct link to heading">#</a></h2><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="extranativecomponentconfig"></a><code>extraNativeComponentConfig()</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#extranativecomponentconfig" title="Direct link to heading">#</a></h3><div class="mdxCodeBlock_xYIz"><div class="codeBlockContent_rlEb"><button tabindex="0" type="button" aria-label="Copy code to clipboard" class="copyButton_kOW4">Copy</button><div class="prism-code language-jsx codeBlock_1AP7"><div class="codeBlockLines_1boI" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token keyword" style="color:#c5a5c5">static</span><span class="token plain"> </span><span class="token function" style="color:#79b6f2">extraNativeComponentConfig</span><span class="token punctuation" style="color:#657b83">(</span><span class="token punctuation" style="color:#657b83">)</span></div></div></div></div></div><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="goforward"></a><code>goForward()</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#goforward" title="Direct link to heading">#</a></h3><div class="mdxCodeBlock_xYIz"><div class="codeBlockContent_rlEb"><button tabindex="0" type="button" aria-label="Copy code to clipboard" class="copyButton_kOW4">Copy</button><div class="prism-code language-jsx codeBlock_1AP7"><div class="codeBlockLines_1boI" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token function" style="color:#79b6f2">goForward</span><span class="token punctuation" style="color:#657b83">(</span><span class="token punctuation" style="color:#657b83">)</span><span class="token punctuation" style="color:#657b83">;</span></div></div></div></div></div><p>Go forward one page in the web view&#x27;s history.</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="goback"></a><code>goBack()</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#goback" title="Direct link to heading">#</a></h3><div class="mdxCodeBlock_xYIz"><div class="codeBlockContent_rlEb"><button tabindex="0" type="button" aria-label="Copy code to clipboard" class="copyButton_kOW4">Copy</button><div class="prism-code language-jsx codeBlock_1AP7"><div class="codeBlockLines_1boI" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token function" style="color:#79b6f2">goBack</span><span class="token punctuation" style="color:#657b83">(</span><span class="token punctuation" style="color:#657b83">)</span><span class="token punctuation" style="color:#657b83">;</span></div></div></div></div></div><p>Go back one page in the web view&#x27;s history.</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="reload"></a><code>reload()</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#reload" title="Direct link to heading">#</a></h3><div class="mdxCodeBlock_xYIz"><div class="codeBlockContent_rlEb"><button tabindex="0" type="button" aria-label="Copy code to clipboard" class="copyButton_kOW4">Copy</button><div class="prism-code language-jsx codeBlock_1AP7"><div class="codeBlockLines_1boI" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token function" style="color:#79b6f2">reload</span><span class="token punctuation" style="color:#657b83">(</span><span class="token punctuation" style="color:#657b83">)</span><span class="token punctuation" style="color:#657b83">;</span></div></div></div></div></div><p>Reloads the current page.</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="stoploading"></a><code>stopLoading()</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#stoploading" title="Direct link to heading">#</a></h3><div class="mdxCodeBlock_xYIz"><div class="codeBlockContent_rlEb"><button tabindex="0" type="button" aria-label="Copy code to clipboard" class="copyButton_kOW4">Copy</button><div class="prism-code language-jsx codeBlock_1AP7"><div class="codeBlockLines_1boI" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token function" style="color:#79b6f2">stopLoading</span><span class="token punctuation" style="color:#657b83">(</span><span class="token punctuation" style="color:#657b83">)</span><span class="token punctuation" style="color:#657b83">;</span></div></div></div></div></div><p>Stop loading the current page.</p></div></article><div class="docMetadata margin-vert--xl"><div class="row"><div class="col"><a href="https://github.com/facebook/react-native-website/blob/master/website/versioned_docs/version-0.63/webview.md" target="_blank" rel="noreferrer noopener"><svg fill="currentColor" height="1.2em" width="1.2em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 40 40" style="margin-right:0.3em;vertical-align:sub"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col text--right"><em><small class="docMetadata-updated">Last updated on <time datetime="2020-12-07T11:00:02.000Z" class="docLastUpdatedAt_1gIo">12/7/2020</time></small></em></div></div></div><div class="margin-vert--lg"><nav class="pagination-nav" aria-label="Blog list page navigation"><div class="pagination-nav__item"></div><div class="pagination-nav__item pagination-nav__item--next"></div></nav></div></div></div><div class="col col--3"><div class="tableOfContents_3iuQ"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#props" class="table-of-contents__link">Props</a><ul><li><a href="#source" class="table-of-contents__link"><code>source</code></a></li><li><a href="#automaticallyadjustcontentinsets" class="table-of-contents__link"><code>automaticallyAdjustContentInsets</code></a></li><li><a href="#injectjavascript" class="table-of-contents__link"><code>injectJavaScript</code></a></li><li><a href="#injectedjavascript" class="table-of-contents__link"><code>injectedJavaScript</code></a></li><li><a href="#mediaplaybackrequiresuseraction" class="table-of-contents__link"><code>mediaPlaybackRequiresUserAction</code></a></li><li><a href="#nativeconfig" class="table-of-contents__link"><code>nativeConfig</code></a></li><li><a href="#onerror" class="table-of-contents__link"><code>onError</code></a></li><li><a href="#onload" class="table-of-contents__link"><code>onLoad</code></a></li><li><a href="#onloadend" class="table-of-contents__link"><code>onLoadEnd</code></a></li><li><a href="#onloadstart" class="table-of-contents__link"><code>onLoadStart</code></a></li><li><a href="#onmessage" class="table-of-contents__link"><code>onMessage</code></a></li><li><a href="#onnavigationstatechange" class="table-of-contents__link"><code>onNavigationStateChange</code></a></li><li><a href="#originwhitelist" class="table-of-contents__link"><code>originWhitelist</code></a></li><li><a href="#rendererror" class="table-of-contents__link"><code>renderError</code></a></li><li><a href="#renderloading" class="table-of-contents__link"><code>renderLoading</code></a></li><li><a href="#scalespagetofit" class="table-of-contents__link"><code>scalesPageToFit</code></a></li><li><a href="#onshouldstartloadwithrequest" class="table-of-contents__link"><code>onShouldStartLoadWithRequest</code></a></li><li><a href="#startinloadingstate" class="table-of-contents__link"><code>startInLoadingState</code></a></li><li><a href="#decelerationrate" class="table-of-contents__link"><code>decelerationRate</code></a></li><li><a href="#domstorageenabled" class="table-of-contents__link"><code>domStorageEnabled</code></a></li><li><a href="#javascriptenabled" class="table-of-contents__link"><code>javaScriptEnabled</code></a></li><li><a href="#mixedcontentmode" class="table-of-contents__link"><code>mixedContentMode</code></a></li><li><a href="#thirdpartycookiesenabled" class="table-of-contents__link"><code>thirdPartyCookiesEnabled</code></a></li><li><a href="#useragent" class="table-of-contents__link"><code>userAgent</code></a></li><li><a href="#allowsinlinemediaplayback" class="table-of-contents__link"><code>allowsInlineMediaPlayback</code></a></li><li><a href="#bounces" class="table-of-contents__link"><code>bounces</code></a></li><li><a href="#contentinset" class="table-of-contents__link"><code>contentInset</code></a></li><li><a href="#datadetectortypes" class="table-of-contents__link"><code>dataDetectorTypes</code></a></li><li><a href="#scrollenabled" class="table-of-contents__link"><code>scrollEnabled</code></a></li><li><a href="#geolocationenabled" class="table-of-contents__link"><code>geolocationEnabled</code></a></li><li><a href="#allowuniversalaccessfromfileurls" class="table-of-contents__link"><code>allowUniversalAccessFromFileURLs</code></a></li><li><a href="#allowfileaccess" class="table-of-contents__link"><code>allowFileAccess</code></a></li><li><a href="#usewebkit" class="table-of-contents__link"><code>useWebKit</code></a></li><li><a href="#url" class="table-of-contents__link"><code>url</code></a></li><li><a href="#html" class="table-of-contents__link"><code>html</code></a></li></ul></li><li><a href="#methods" class="table-of-contents__link">Methods</a><ul><li><a href="#extranativecomponentconfig" class="table-of-contents__link"><code>extraNativeComponentConfig()</code></a></li><li><a href="#goforward" class="table-of-contents__link"><code>goForward()</code></a></li><li><a href="#goback" class="table-of-contents__link"><code>goBack()</code></a></li><li><a href="#reload" class="table-of-contents__link"><code>reload()</code></a></li><li><a href="#stoploading" class="table-of-contents__link"><code>stopLoading()</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container"><div class="row footer__links"><div class="col footer__col"><h4 class="footer__title">Docs</h4><ul class="footer__items"><li class="footer__item"><a class="footer__link-item" href="/docs/getting-started">Getting Started</a></li><li class="footer__item"><a class="footer__link-item" href="/docs/tutorial">Tutorial</a></li><li class="footer__item"><a class="footer__link-item" href="/docs/components-and-apis">Components and APIs</a></li><li class="footer__item"><a class="footer__link-item" href="/docs/more-resources">More Resources</a></li></ul></div><div class="col footer__col"><h4 class="footer__title">Community</h4><ul class="footer__items"><li class="footer__item"><a class="footer__link-item" href="/help">The React Native Community</a></li><li class="footer__item"><a class="footer__link-item" href="/showcase">Who&#x27;s using React Native?</a></li><li class="footer__item"><a href="https://stackoverflow.com/questions/tagged/react-native" target="_blank" rel="noopener noreferrer" class="footer__link-item">Ask Questions on Stack Overflow</a></li><li class="footer__item"><a href="https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md" target="_blank" rel="noopener noreferrer" class="footer__link-item">Contributor Guide</a></li><li class="footer__item"><a href="https://dev.to/t/reactnative" target="_blank" rel="noopener noreferrer" class="footer__link-item">DEV Community</a></li></ul></div><div class="col footer__col"><h4 class="footer__title">Find us</h4><ul class="footer__items"><li class="footer__item"><a class="footer__link-item" href="/blog">Blog</a></li><li class="footer__item"><a href="https://twitter.com/reactnative" target="_blank" rel="noopener noreferrer" class="footer__link-item">Twitter</a></li><li class="footer__item"><a href="https://github.com/facebook/react-native" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub</a></li></ul></div><div class="col footer__col"><h4 class="footer__title">More</h4><ul class="footer__items"><li class="footer__item"><a href="https://reactjs.org/" target="_blank" rel="noopener noreferrer" class="footer__link-item">React</a></li><li class="footer__item"><a href="https://opensource.facebook.com/legal/privacy" target="_blank" rel="noopener noreferrer" class="footer__link-item">Privacy Policy</a></li><li class="footer__item"><a href="https://opensource.facebook.com/legal/terms" target="_blank" rel="noopener noreferrer" class="footer__link-item">Terms of Service</a></li></ul></div></div><div class="text--center"><div class="margin-bottom--sm"><a href="https://opensource.facebook.com" target="_blank" rel="noopener noreferrer" class="footerLogoLink_19Ac"><img class="footer__logo" alt="Facebook Open Source Logo" src="/img/oss_logo.png"></a></div><div>Copyright © 2021 Facebook, Inc.</div></div></div></footer></div>
<script src="/styles.07d522c6.js"></script>
<script src="/runtime~main.579b1f59.js"></script>
<script src="/main.5e05a427.js"></script>
<script src="/1.ba9ce8bd.js"></script>
<script src="/2.58cb5d3d.js"></script>
<script src="/1f391b9e.a824c215.js"></script>
<script src="/943.8b024446.js"></script>
<script src="/ee5b3385.b4fff665.js"></script>
<script src="/17896441.0c201679.js"></script>
<script src="/3d8443ce.fb4d5926.js"></script>
</body>
</html>