Problem with Webview after 'exp publish'

#1

Hey;

I have a question/problem/possible bug. I have an expo project and basically there is an WebView that uses a local .html file (which is a react project’s output) It works as intended in the hot reloading (in my local with qr code) but when I use exp publish probably expo uploads “only” .html file and it does not work. Am I missing something?

Here is a screenshot of the project

Here is the mentioned published project: https://expo.io/@burak/wordlink

0 Likes

Include local CSS/JavaScript in WebView
#2

I saw this; https://github.com/facebook/react-native/issues/1442

I probably have to eject.

0 Likes

#3

@burak, I also have an app that uses a webview and worked in development, but does not display the webview when published. I am also importing my html from a file the same way that you did. Did you find a solution to your problem?

0 Likes

#4

Yes I did found a solution.

What I did was to upload the files on a server first. Then at first session of the app, I downloaded that files to the local storage of the Expo app. Using filesystem api, then importing the index.html from assets solve the problem.

Tho, its so indirect and hard to maintain in terms of having to have a server or repository. So I used a github repository to store that data and download the files to local from there.

And actually published that app, see here: https://play.google.com/store/apps/details?id=org.dreamoriented.wordpack

You will notice that in the start of the game, it will sync files from remote github repository.

see filesystem api: https://docs.expo.io/versions/latest/sdk/filesystem.html
also downloadAsync method: https://docs.expo.io/versions/latest/sdk/filesystem.html#expofilesystemdownloadasyncuri-fileuri-options

I would really still love to have a way to do this in expo tho.

If you have any more questions mail me at info@dreamoriented.org

0 Likes

#5

Thanks for the reply. I will give this a try. I agree that there should be some way to do this with expo. Honestly, I hope this capability is included in the improvements to offline bundling included in SDK 24.

0 Likes