# react-native-version-number

> Access app version inside React Native

Latest version **0.3.6** (published 2019-05-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-native-version-number
pnpm add react-native-version-number
yarn add react-native-version-number
bun add react-native-version-number
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.6 |
| Published | 2019-05-15 |
| First published | 2016-08-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/react-native-version-number) |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 32.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 379 |
| Author | Alvaro Medina Ballester |
| Maintainers | alvaromb |
| Keywords | react, react-native, ios, react-component |

## Links

- npm: https://www.npmjs.com/package/react-native-version-number
- Repository: https://github.com/APSL/react-native-version-number
- Homepage: https://github.com/APSL/react-native-version-number#readme
- Issues: https://github.com/APSL/react-native-version-number/issues
- npm.io page: https://npm.io/package/react-native-version-number

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.3.6 (latest) — 2019-05-15
- 0.3.5 — 2018-10-30
- 0.3.4 — 2018-05-29
- 0.3.3 — 2018-05-03
- 0.3.2 — 2018-03-16
- 0.3.1 — 2018-02-01
- 0.3.0 — 2017-10-20
- 0.2.0 — 2017-10-09
- 0.1.3 — 2017-08-09
- 0.1.2 — 2017-03-14
- 0.1.1 — 2016-09-02
- 0.1.0 — 2016-08-26

## README

# react-native-version-number

<p>
<img src="https://travis-ci.org/APSL/react-native-version-number.svg?branch=master" />
<img src="https://img.shields.io/npm/dm/react-native-version-number.svg" />
<img src="https://img.shields.io/npm/dt/react-native-version-number.svg" />
</p>

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:
```java
include ':react-native-version-number'   
project(':react-native-version-number').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-version-number/android')
```

2. In your android/app/build.gradle file, add the `:react-native-version-number` project as a compile-time dependency:

```java
...
dependencies {
    ...
    compile project(':react-native-version-number')
}
```

3. Update the MainApplication.java file to use `react-native-version-number` via the following changes:   

```java
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
```javascript
import VersionNumber from 'react-native-version-number';

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

```

## License
MIT.

---
_Source: https://npm.io/package/react-native-version-number · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
