Skip to content

Insert JS file from local repository #3135

Closed Answered by albertcito
albertcito asked this question in Q&A
Discussion options

You must be logged in to vote

I was able to do it with inline. I just do the same example here. I paste the value from ./path/to/my/file.js in a HTML file:

This is the file test.html

<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width,initial-scale=1" />
    <script>
        window.addEventListener('load', function() {
           // 👉 Paste the content from `./path/to/my/file.js` here 👈
        });
    </script>
  </head>
  <body>
    <div id="root"></div>
  </body>
</html>

And I call the WebView here:

   const localHtmlFile = require('./test.html');
   <WebView source={localHtmlFile} />

It works 🎉 !!!!!!!!!!

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by albertcito
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant