diff --git a/Examples/UIExplorer/js/WebViewExample.js b/Examples/UIExplorer/js/WebViewExample.js index be1fb44aec1148..a0f3c635737ca6 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} + /> + +