birdofpreyru / react-native-static-server

Embedded HTTP server for React Native
https://dr.pogodin.studio/docs/react-native-static-server
Other
142 stars 22 forks source link

Approaches to best load local HTML #53

Closed qwertynik closed 1 year ago

qwertynik commented 1 year ago

What are the best practices to load and view HTML stored locally on the device? Attempted to find suggestions in the README.md but could not find any.

Usually when building PWA's caching static resources and serving them is relatively straightforward. window.cache, works pretty well. No server management, or other maintenance required. Of course, there are space limitations imposed on PWA apps. Are there any such best practices/internal features that can be used when rendering locally stored HTML in a WebView?

This is not an issue as such. But since discussion is not available, using issues.

birdofpreyru commented 1 year ago

Hmm... doesn't this work for you? https://github.com/birdofpreyru/react-native-static-server/tree/master#bundling-in-server-assets-into-an-app-statically Or are you looking for something different?

qwertynik commented 1 year ago

This worked. (except for videos not loading - this could be a react-native-webview package issue)

However, not all assets can be bundled directly into the app and they will need to be served from the local storage. For those cases, wanted to know the best way to do it.

birdofpreyru commented 1 year ago

However, not all assets can be bundled directly into the app and they will need to be served from the local storage. For those cases, wanted to know the best way to do it.

Yeah, I guess, you just do what you wrote: download them to some local location from where you can serve them with this library. I haven't tried something like this myself, thus I have nothing to add, beside that this looks perfectly doable to me.

qwertynik commented 1 year ago

Ok. Will attempt this approach.