Search code examples
react-nativeexpoprogressive-web-apps

how can I change web application without changing the app with expo


I have an expo react native project which works perfectly fine on every android device that I have tried.
but when I tried to build a pwa version of the project with expo build:web , the components renders in a totally wrong position and the output is not acceptable at all.
I want to know if anyone has the same problem with expo web builds, and how you manage to fix this problem.
is there any way that I change the implementation of the web application without changing the output of android app?

thank you all.


Solution

  • Did you try to use Platform Specific Code with https://reactnative.dev/docs/platform-specific-code

    With your situation, it will be something like this

    HeaderBar.js         # Webpack, Rollup or any other Web bundler
    HeaderBar.native.js  # React Native bundler for both Android and iOS (Metro)
    HeaderBar.android.js # Android only