Giter Club home page Giter Club logo

react-native-version-number's Introduction

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 react-native-version-number

Manual installation

Android:

  1. In your android/settings.gradle file, make the following additions:
include ':react-native-version-number'   
project(':react-native-version-number').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-version-number/android')
  1. In your android/app/build.gradle file, add the :react-native-version-number project as a compile-time dependency:
...
dependencies {
    ...
    compile project(':react-native-version-number')
}
  1. Update the MainApplication.java file to use react-native-version-number via the following changes:
import com.apsl.versionnumber.RNVersionNumberPackage;

public class MainApplication extends Application implements ReactApplication {

    private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
        ...
        @Override
        protected List<ReactPackage> getPackages() {
            return Arrays.<ReactPackage>asList(
                    new MainReactPackage(),
                    new RNVersionNumberPackage(), // here
            );
        }
    };
    ...
}

Usage

import VersionNumber from 'react-native-version-number';

console.log(VersionNumber.appVersion);
console.log(VersionNumber.buildVersion);
console.log(VersionNumber.bundleIdentifier);

License

MIT.

react-native-version-number's People

Contributors

alvaromb avatar andrewxhill avatar asutula avatar cwdn avatar enagorny avatar gvillenave avatar hhunaid avatar hkxicor avatar jcmais avatar lastin avatar lfkwtz avatar maxmamis avatar mmmurf avatar moreno97 avatar neilkimmett avatar oceanhorn avatar sbycrosz avatar trondwh avatar vtsatskin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.