react-native-version-number
Returns the CFBundleShortVersionString
and the CFBundleVersion
and bundleIdentifier
on IOS. For Android, returns the versionName
, versionCode
and applicationId
.
iOS | Android | Example | |
---|---|---|---|
appVersion | CFBundleShortVersionString |
versionName |
1.0.2 |
buildVersion | CFBundleVersion |
versionCode |
42 |
bundleIdentifier | bundleIdentifier |
applicationId |
com.foo.bar.MyApp |
Getting started
Install the package
$ yarn add react-native-version-number
Link
$ react-native link
Manual installation
Android:
- In your android/settings.gradle file, make the following additions:
include ':react-native-version-number' .projectDir = new File(rootProject.projectDir, '../node_modules/react-native-version-number/android')
- In your android/app/build.gradle file, add the
:react-native-version-number
project as a compile-time dependency:
...dependencies { ... compile }
- Update the MainApplication.java file to use
react-native-version-number
via the following changes:
Usage
; console;console;console;
License
MIT.