I’m looking for solution to migrate web app to mobile application platforms ASAP, and was thinking about to migrate web to pwa, and then upload to stores.
Any difficulties and pitfalls I can face with this approach?
I’m looking for solution to migrate web app to mobile application platforms ASAP, and was thinking about to migrate web to pwa, and then upload to stores.
Any difficulties and pitfalls I can face with this approach?
2
Answers
The answer is No at least for the App store which is not PWA friendly.
You might be able to achieve this for the Play Store here
My advice would be to code your app in React Native.
You won’t need to change the logic and the way you connect your app to your back end.
If you already use the
StyleSheet
component to manage your style, the main thing you need to change in your code is theJSX
part using the Core Component provided by React Native like the following (basic exemple)to
Make sure to adapt the style as needed. Have a look at the shadows for exemple as it’s specific to both Android and iOS.
You also have to pay attention to the React Native specific behavior, for exemple for the input,
TextInput
in RN.to
Another tips are to check the
FlatList
Component to manage your lists instead ofmap()
, and get started withExpo
if it’s your first time coding with RN as it’s easier to get started with.I acknowledge it’s a bit of work because unlike React that uses React Dom to display your app on the web, React Native connects your Components to both native platforms Android and iOS, but still better than rewrite the entire app.
For posterity. A quick guide on converting a web application to a progressive web application (PWA).
It is relatively easy. I will summarize and get you in the right direction.
First and foremost; ensure your application is served over HTTPS for security reasons. Many core PWA technologies, such as service workers, require HTTPS.
Next include a manifest file. The W3 organization has a specification for the content of your
manifest.json
file which are necessary for making your application a PWA.While according to the spec, all of the manifest keys are optional, some browsers, operating systems, and app distributors have required keys for a web app to be a PWA.
If you are done playing with the
manifest.json
file, add it to your root html template. I know this is done by default increate-react-app
but if it isn’t already, then just do this:Debugging might come in handy to ensure there are no bugs. See Debugging Manifest Files on MDN.
Next, add a service worker. The service worker will be responsible for making the application work offline while making sure the application is always up to date. In here we:
Once you are done playing with your service worker, register the worker.
If you also want to learn to debug service workers, see Debugging Service Workers on MDN.
For a good tutorial, see CycleTracker tutorial on MDN.
TL;DR
Some mobile application stores allow PWAs while others don’t. But is this really a necessary step? I would recommend implementing the "Add to Home Screen" prompt [web.dev] to encourage users to install your PWA from your web app directly instead.