Import statically could be a way, by I tried and still doesn’t work (I escaped all the back-ticks in the code), I sure there is a way to make it work: Some plain client side javascript works, can’t see a reason this library don’t have to.
Anyway, there is a way I can catch all the WebView console errors and logs? I suspect renderError
do not doing that the way I’m using it.
I tried to make a snack hoping someone way more skilled than me would help…the browser crashes when I upload a ~2MB single js file 
This is the whole code
import React, { Component } from 'react';
import { WebView, StyleSheet,ActivityIndicator } from 'react-native';
import style from "./css"
import jsGraph from './jsGraph';
import visjs from './VISJs'; //<-- this is Vis.js lib (http://visjs.org/dist/vis.js) wrapped in a <script> tag like jsGraph and backtick escaped
const fullPost = `
<html>
<head>
</head>
<body>
<div id="mynetwork"></div>
</body>
</html>`;
export default class App extends Component {
render() {
return (
<WebView
style={styles.WebViewStyle}
source={{ html: fullPost}}
javaScriptEnabled={true}
domStorageEnabled={true}
renderError={(error)=>console.log('error:'+error)}
renderLoading={()=>{return(<ActivityIndicator style={{flex: 1,flexDirection: 'row',justifyContent: 'space-around',padding: 10}} size="large" color="#1a237e" />)}}
startInLoadingState
/>
);
}
}
const styles = StyleSheet.create({
WebViewStyle:
{
justifyContent: 'center',
alignItems: 'center',
flex:1
}
});
jsGraph
const jsGraph = `
<script type="text/javascript">
// create an array with nodes
var nodes = new vis.DataSet([
{id: 1, label: 'Node 1'},
{id: 2, label: 'Node 2'},
{id: 3, label: 'Node 3'},
{id: 4, label: 'Node 4'},
{id: 5, label: 'Node 5'}
]);
// create an array with edges
var edges = new vis.DataSet([
{from: 1, to: 3},
{from: 1, to: 2},
{from: 2, to: 4},
{from: 2, to: 5},
{from: 3, to: 3}
]);
// create a network
var container = document.getElementById('mynetwork');
var data = {
nodes: nodes,
edges: edges
};
var options = {};
var network = new vis.Network(container, data, options);
</script>`;
export default jsGraph;
css
const css = `
<style>
body {
background: grey;
}
#mynetwork {
width: 600px;
height: 400px;
border: 1px solid lightgray;
}
</style>
`;
export default css;
DIFFERENT OPTION: This is the solution I was talking in the second post of this thread (obiouvsly it’s a different solution than the above code). It works testing on android device in debug release, it doesn’t if I build the expo release build. Basically the solution not uses a plain javascript code, but a webpack bundled code. Really can’t tell what’s the magic webpack does in this case.