Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How should we use the same version for both iOS and Android

Currently whenever I made changes to React Native applications, I will have to change version number in multiple places

1. package.json

{
  "name": "My Awesome App",
  "version": "1.2.0",
  ...
}

2. ios/MyAwesomeApp/Info.plist

<key>CFBundleShortVersionString</key>
<string>1.2.0</string>

3. android/app/build.gradle

defaultConfig {
    ...
    versionCode 1
    versionName "1.2.0"

4. Update versioning number in my "About" app component

Is there a much simpler way to handle updating versioning like for example configuring in such a way where Info.plist and build.gradle automatically pointing to package.json?

like image 405
Isaac Avatar asked Oct 01 '18 08:10

Isaac


People also ask

Can we use same code for Android and iOS?

Reusable code This is one of the greatest advantages of cross-platform development – you can build just one codebase for both Android and iOS at the same time.


1 Answers

You could use react-native-version-up which allows you to bump the version in different ways in your package.json, build.gradle and info.plist.

Personally, I do not go with the approach of keeping all in sync. Since I'm following semver for all my JS-based projects, it can happen that some changes (i.e. a bugfix) affect only one platform and in that case, I would need to bump the version only for that one platform.

like image 64
Matei Radu Avatar answered Oct 06 '22 23:10

Matei Radu