I'm going to create a React Native app with WebView. This View must contain local HTML and Javascript files. This is the code.
---> WVView.js
...
render(){
return (
<View style={{flex:1}}>
<StatusBar/>
<WebView
nativeConfig={{props: {webContentsDebuggingEnabled: true}}}
ref={webview => { this.myWebView = webview; }}
source={require('./Resources/index.html')}
javaScriptEnabled={true}
injectedJavaScript={}
onMessage={this.onWebViewMessage}
style={{flexBasis: 1, flexGrow:1}}
scrollEnabled={false}
/>
</View>
);
}
...
---> index.html
<div class="widget-container">
<div id="test12"></div>
<script type="text/javascript" src="./Utils.js"></script>
<script type="text/javascript" src="./WebViewBrdge.js"></script>
<script type="text/javascript" src="./TVS.js"></script>
</div>
---> Directory
|__ WVView.js
|__ Resources
|__ index.html
|__ Utils.js
|__ WebViewBridge.js
|__ TVS.js
Please, can you suggest the best way to develop this solution? When I read the documentation, I find code like source{{html:...}} or injectedJavascript for loading static local javascript. I don't find a similar example.
Now I can't load javascript files. Thanks