espritblock / react-native-eos

react-native-eos create by espritblock
http://eblock.io
GNU General Public License v3.0
54 stars 18 forks source link

Works on expo but doesn't work when uploaded to testflight or apk #6

Open agarwalmridul09 opened 5 years ago

agarwalmridul09 commented 5 years ago

The EOS module works perfectly when testing on simulators using Expo. When I build the application, ios or android, it doesn't work in the standalone applications.

ChenLi0830 commented 5 years ago

@agarwalmridul09

As discussed here - https://forums.expo.io/t/solved-local-javascript-in-webview/9198/7

It's hard for Expo packager to view JS files as assets that are not part of the main project JS bundle.

So basically the reason this package is not working for published Expo project is because the js files used by the eosjs.html are not bundled into the code.

To solve that, a quick solution is simply put the javascript files (api.js, eos.js and es5.js) inline into the eosjs.html file. You'll need to edit eosjs.html in the source code of this package to make it work.

More specifically, change this

// eosjs.html file
<html>
  <head>
    <meta charset="utf-8">
    <script src="es5.js"></script>
    <script src="eos.js"></script>
    <script src="api.js"></script>
  </head>
  <body></body>
</html>

into this

// eosjs.html file
<html>
  <head>
    <meta charset="utf-8">
    <script type="text/javascript">
        ...content of es5.js
    </script>
    <script type="text/javascript">
        ...content of eos.js
    </script>
    <script type="text/javascript">
        ...content of api.js
    </script>
  </head>
  <body></body>
</html>