highcharts / highcharts-react-native

Other
103 stars 79 forks source link

Not working if expo published #3

Closed sidmorizon closed 4 years ago

sidmorizon commented 5 years ago

Hi, it's working on expo start at local development, but when I build a native iOS or Android bundle as expo build:ios or expo publish, it does not working

sidmorizon commented 5 years ago

It seems that the html file load js or css as relative path, it works when serve on local dev server, but can not reference in published bundle

sebastianbochan commented 5 years ago

Hi @zuozhuo, Thank you for reporting about the bug. I will check it.

r-bman commented 5 years ago

It is my understanding that iOS webviews load local static files from an internal local webserver on port 8081. The static file requests look something like http://localhost:8081/assets/node_modules/@highcharts/highcharts-react-native/highcharts-layout/css/styles.css. The webview doesn't seem to have access to, or permission to access or execute files in the node_modules/@highcharts... directory once the App is compiled.

I have detailed a solution for ejected Apps here but I don't know how this can be applied to expo Apps.

sebastianbochan commented 5 years ago

@zuozhuo Can you test solution of @r-bman and let us know about your results.

sebastianbochan commented 4 years ago

The new version (2.0.2) has been already released.

Please test and let me know about your results.

axelav commented 4 years ago

has this been resolved? I am using v2.1.1 and am experiencing this issue. everything worked great locally but when the app was published, I get an empty box where the highchart should render.

this really seems like something that should be mentioned in the readme. not something users find out after only after publishing their apps.

sebastianbochan commented 4 years ago

Have you tried to move files to the correct path (android) -> https://github.com/highcharts/highcharts-react-native#files-are-not-loaded

axelav commented 4 years ago

no, this was with an iOS app published with Expo and released through the Apple App Store.

r-bman commented 4 years ago

I tested this a little while ago but haven't had chance to comment. I was unable to get the latest version of the library working with local highcharts files on iOS using this method, which worked previously. IIRC the error I received in the webview console was something to do with CORS. I was only able to get the library working when the highcharts files are loaded from the cdn.

axelav commented 4 years ago

@r-bman so if you loaded the files from the CDN, did it work in a published app, or just locally when developing? would it be possible for you to show your code of how you configured using the CDN? I'm unclear if it involves more than just passing the useCDN prop - ie, what is the CDN URL, which version of highcharts is this loading from CDN, etc?

r-bman commented 4 years ago

@axelav I haven't published an App using this library so I'm afraid I can't help you there. I think I just set the useCDN prop to true, yes. You can see what the useCDN prop does in HighchartsReactNative.js. I opted not to use this library in the end, in favour of a custom solution which is not currently published.

axelav commented 4 years ago

@r-bman gotcha, thanks for that info!

sebastianbochan commented 4 years ago

It can be related with the issue react-native-community/react-native-webview#875, Im waiting for a feedback from users about that.

axelav commented 4 years ago

any further info on this one?

sebastianbochan commented 4 years ago

At this moment all problems are combined and described here: https://github.com/highcharts/highcharts-react-native/issues/39 (also including some fixes/workarounds).