Open accelerate-dm opened 1 year ago
All files resolved from webViewRender entry point will be bundled into one file and run in WebView.
In that process, all require()
and import
will be bundle by metro bundler but others like var myScript = new_script("packages/app/features/stockfishScript/myAlert.js");
will not. So I think you have to replace the path with actual code in the build process by yourself.
All files resolved from webViewRender entry point will be bundled into one file and run in WebView.
In that process, all
require()
andimport
will be bundle by metro bundler but others likevar myScript = new_script("packages/app/features/stockfishScript/myAlert.js");
will not. So I think you have to replace the path with actual code in the build process by yourself.
Thank you for the quick response.
Are you suggesting we use the new_script function as is but instead of using a path we copy the whole code block in myAlert.js inside the double quotes? Or should we not use the new_script function at all and refer to our code in a different way? We're struggling to understand how we should reference the code block. This is our standalone setup that runs by itself in html/js that we are trying to run inside the react component using react-native-react-bridge: https://gist.github.com/zserge/6617cdbf328aac76913ff9ae85350c10
We are currently facing an issue with loading a local script file in our Expo app when using the react-native-react-bridge library. The goal is to render a React component within the Expo app and enable communication between the native and web components using the emit method. Our main challenge lies in loading a script file stored locally. We've attempted various methods, including using a Promise with document.createElement('script'), as shown below:
Additionally, we've explored using libraries like "react-script-tag" and "react-helmet" but have not been successful in loading the script. Interestingly, the same script loads as expected when used in a React web app without "react-native-react-bridge." Here's a simplified example of our React code that utilizes "react-native-react-bridge": // WebApp.js
On the native side, we have a component like this:
We'd greatly appreciate any insights or suggestions to resolve this issue and successfully load the local script in our Expo app when using "react-native-react-bridge." Thank you!