agilgur5 / react-native-manga-reader-app

[Alpha] A React Native / Expo app for cross-platform manga reading
https://expo.io/@agilgur5/react-native-manga-reader-app
Other
16 stars 4 forks source link

Create a web version with `react-native-web` #10

Open agilgur5 opened 5 years ago

agilgur5 commented 5 years ago

To get to the vision in the "Why?" section -- build for all 3 codebases simultaneously. This does limit the usage of some libraries/components however, as they have to be built to be used on all 3 (typically they're only for mobile or for web).

The web version could also be used/demo'd immediately, no need to download/install an app.

Ejecting Expo and figuring out some custom Haul/spinjs/webpack integration in addition would make it most of the way there.

agilgur5 commented 5 years ago

Annnd apparently Expo recently (legit 2 months ago) added support for PWAs w/ RNW 😮

See the blog post and the examples repo. Most of the links in the blog post no longer work (probably bc they don't reference a commit tree 😅 ) so go to the repo directly.

It's still a WIP, so not super well documented and not sure that customizing index.html / webpack in JSON doesn't seem totally optimal. There seems to be a way to load your own webpack config and your own index.html though, which is very interesting. (side note that it uses Workbox instead of offline-plugin 😢 )

Might add this when updating to SDK 33 (#11 ) or upgrade to 32 (or is it 33 preview? instructions say expo@next) specifically for this.

agilgur5 commented 5 years ago

Welp, made a web-support branch for this on top of #12 annnd it fell pretty flat 😢

There are some issues with Expo Web, but getting past that leads to more fundamental issues: CORS makes web mode unusable 😢 😢 Most sites/providers don't allow CORS and don't have any support for safelisted Content-Types (i.e. text/plain) either. This is probably a lost cause 😞

agilgur5 commented 5 years ago

Tried to do a workaround by adding an iframe, and the iframe actually did load, but I was unable to parse the iframe's document (second error as listed here), so yea pretty sure this isn't possible without some form of proxying. Maybe it's ok to ask users to add an extension or something? Or otherwise would have to run a server to support this. Could use a free CORS proxy (or run one for free on like Zeit), but this isn't really what most are meant for I don't think :/