diff --git a/Examples/UIExplorer/js/WebViewExample.js b/Examples/UIExplorer/js/WebViewExample.js index be1fb44ae..a0f3c6357 100644 --- a/Examples/UIExplorer/js/WebViewExample.js +++ b/Examples/UIExplorer/js/WebViewExample.js @@ -264,6 +264,35 @@ class MessagingTest extends React.Component { } } +class InjectJS extends React.Component { + webview = null; + injectJS = () => { + const script = 'document.write("Injected JS ")'; // eslint-disable-line quotes + if (this.webview) { + this.webview.injectJavaScript(script); + } + } + render() { + return ( + + { this.webview = webview; }} + style={{ + backgroundColor: BGWASH, + height: 300, + }} + source={{uri: 'https://www.facebook.com'}} + scalesPageToFit={true} + /> + +