Ability to Inject a React Component into WebView?
See original GitHub issueWhile the injectedJavaScript
allows for the passing of flat, ES5 javascript to a WebView, is there a way to pass in a web React component to WebView? By that I mean, pass it in locally by import (not pointing to a webpage online)? Something along the lines of:
import MySuperComplexD3WebComponent from 'somewhere';
<WebView
injectedJavaScript={<MySuperComplexD3WebComponent data={data} />}
/>
This would allow the WebView component to serve as a true renderer for normal react web components rather than having to rely on an http connection to present an already-rendered component living somewhere online.
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
How to inject React Component inside WebView (react-native ...
You can render a React component to its initial HTML with renderToString() and then display it inside your WebView like so:
Read more >Injecting JavaScript into React Native Webview | by Idan Levi
Let's move on to another more interesting ability, get an answer from the Webview after a particular trigger. We'll use postMessage & onMessage ......
Read more >Injecting Custom JavaScript Into React Native Webview
This tutorial explains how to inject custom javascript in webview component in react native application.The injectedJavaScript is a custom ...
Read more >Injecting Custom JavaScript into React Native's Webview
First, checkout the documentation about webview component in React native. I was experimenting with the prop named "injectedJavaScript" .
Read more >React native webview: The comprehensive guide you need to ...
Firstly, simply speaking, React native webview is a component that allows your React Native app to load webpages. Besides, in the previous time,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Is there a way to load an npm dependency into the web view? - other than as a string wrapped in a script tag?
For anyone looking to achieve what I was, I was able to get it to work by interpolating HTML and JavaScript directly in my React component and feeding the output to
WebView
. Any external dependencies are loaded viascript
tags in the HTML: