Home > Software engineering >  Bundling different app versions in one React Native app
Bundling different app versions in one React Native app

Time:01-14

I'm working on an enterprise React Native project that targets customers' backend installed on-premises. Some customers are slower than others to upgrade the backend and we still need to support them.

Instead of using feature flags, would it be possible to set up a workflow so that:

  • each release branch gets bundled as (e.g. release-v1, release-v2, release-v3,...)
  • we configure the compatible app version on the backend
  • the React Native opens up, fetches the compatible app version number, and loads up the appropriate bundle

CodePudding user response:

With git you can group different branches that hold different versions of your app:

ANDROID:

path: yourProject/android/app/build.gradle

search and change: "versionCode" and "versionName"

iOS:

  • Open xCode
  • Select app project
  • Go to "General"
  • Change "version"

If you need get app version from Javascript use "react-native-version-info":

https://www.npmjs.com/package/react-native-version-info

The problem you may have with this is that you cannot upload the same application in stores.

To have the same application but with a different packet id, you can use Flavors(Android)/Targets(iOS). This in case you need different builds for the store.

https://medium.com/hackernoon/setting-up-android-like-product-flavors-in-react-native-39b6c011061b

I hope it will be useful to you

CodePudding user response:

You could organise your codebase so that it is flexible for all the different 'flavours' of the app.

For example:

  • Main code branch (all your base code goes in here, shared functionality, etc..)
    • Branch v1 - the differences on top of your 'main' branch for this version
    • Branch v2 - as v1 but with specific changes for v2 users
    • Branch N - ...and so on

Then each Branch 1,2,N version of the app can have it's own bundle Id and be released as a separate app. You have 1 codebase to work on. Updates can be made on main and trickled down to Branch N apps if needed. Specific "Branch" updates can be made and pushed to the relevant code branch.

  •  Tags:  
  • Related