{"id":18425244,"url":"https://github.com/kimxogus/react-native-version-check","last_synced_at":"2025-05-14T00:08:15.619Z","repository":{"id":37406286,"uuid":"70976365","full_name":"kimxogus/react-native-version-check","owner":"kimxogus","description":"A version checker for react-native applications","archived":false,"fork":false,"pushed_at":"2025-05-02T10:06:29.000Z","size":15440,"stargazers_count":751,"open_issues_count":48,"forks_count":187,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-05-07T23:37:00.141Z","etag":null,"topics":["react-native","version","version-check"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kimxogus.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-10-15T08:35:35.000Z","updated_at":"2025-05-04T17:30:43.000Z","dependencies_parsed_at":"2024-06-18T12:34:07.848Z","dependency_job_id":"01dc9287-ceb7-4a88-8752-6a55abc56fe9","html_url":"https://github.com/kimxogus/react-native-version-check","commit_stats":{"total_commits":450,"total_committers":38,"mean_commits":"11.842105263157896","dds":"0.10888888888888892","last_synced_commit":"5c885a81f4e4f06e2f88269413355348dddd6bfe"},"previous_names":[],"tags_count":74,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kimxogus%2Freact-native-version-check","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kimxogus%2Freact-native-version-check/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kimxogus%2Freact-native-version-check/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kimxogus%2Freact-native-version-check/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kimxogus","download_url":"https://codeload.github.com/kimxogus/react-native-version-check/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253391390,"owners_count":21900948,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["react-native","version","version-check"],"created_at":"2024-11-06T05:03:11.919Z","updated_at":"2025-05-14T00:08:15.565Z","avatar_url":"https://github.com/kimxogus.png","language":"Java","funding_links":[],"categories":["Java"],"sub_categories":[],"readme":"# react-native-version-check\n\n[![npm version][npm-image]][npm-url]\n[![npm downloads][downloads-image]][downloads-url]\n[![Build Status][ci-image]][ci-url]\n[![DevDependencies Status][dev-dependencies-image]][dev-dependencies-url]\n[![Known Vulnerabilities][vulnerabilities-image]][vulnerabilities-url]\n\nA version checker for react-native applications.\nThis library gets the latest app version by parsing google play store, apple app store's app information or custom url.\nParsing code is referenced from [here](http://itmir.tistory.com/524)\n\n### Looking for maintainers!\nI have almost zero experience in ios development, and I am no longer working on mobile app development(doing backend and devops works mainly and some web frontend). It makes it hard to maintain this library actively. Hope to have someone to help maintaining react-native-version-check!\n\n### expo\nreact-native-version-check supports [expo](https://expo.io)! with [react-native-version-check-expo](https://www.npmjs.com/package/react-native-version-check-expo)\n- usage\n```js\n// import\nimport VersionCheck from 'react-native-version-check-expo'\n\nVersionCheck.getCountry().then(country =\u003e console.log(country))\n```\n\n## Getting started\n  - npm\n  ```bash\n  $ npm install react-native-version-check\n  ```\n  - yarn\n  ```bash\n  $ yarn add react-native-version-check\n  ```\n\n### Example\n```bash\n$ git clone https://github.com/kimxogus/react-native-version-check.git\n$ cd react-native-version-check/example\n$ yarn # or npm install\n$ react-native run-android # or react-native run-ios\n```\n\n### Automatic Installation\n```bash\n$ react-native link react-native-version-check\n```\n\n### Manual Installation\n#### - iOS - Link Manually\n* Add ```.xcodeproj``` file as library to XCode project.\n  1. In project navigator, right click Libraries\n  2. Select ```Add Files to [PROJECT_NAME]```\n  3. Add the ```node_modules/react-native-version-check/ios/RNVersionCheck.xcodeproj``` file\n\n* Add the ```libRNVersionCheck.a``` from the ```RNVersionCheck``` project to your project's Build Phases \u003e Link Binary With Libraries\n\n#### iOS - CocoaPods Package Manager\n* Add to your `Podfile` (assuming it's in `ios/Podfile`):\n  ```ruby\n  pod 'react-native-version-check', :path =\u003e '../node_modules/react-native-version-check'\n  ```\n* Reinstall pod with `cd ios \u0026\u0026 pod install \u0026\u0026 cd ..`\n\n#### - Android\n\n* Append the following lines to `android/settings.gradle`:\n```gradle\n...\ninclude ':react-native-version-check'\nproject(':react-native-version-check').projectDir = new File(rootProject.projectDir, \t'../node_modules/react-native-version-check/android')\n```\n* Insert the following lines inside the dependencies block in `android/app/build.gradle`:\n```gradle\n...\ndependencies {\n   ...\n   compile project(':react-native-version-check')\n}\n```\n* Open up `android/app/src/main/java/[...]/MainApplication.java`\n```java\n......\nimport io.xogus.reactnative.versioncheck.RNVersionCheckPackage;  // \u003c--- HERE\n\n......\n\n@Override\nprotected List\u003cReactPackage\u003e getPackages() {\n   ......\n   new RNVersionCheckPackage()            // \u003c------ HERE\n   ......\n}\n```\n\n## Usage\n```javascript\nimport { Linking } from 'react-native';\nimport VersionCheck from 'react-native-version-check';\n\nVersionCheck.getCountry()\n  .then(country =\u003e console.log(country));          // KR\nconsole.log(VersionCheck.getPackageName());        // com.reactnative.app\nconsole.log(VersionCheck.getCurrentBuildNumber()); // 10\nconsole.log(VersionCheck.getCurrentVersion());     // 0.1.1\n\nVersionCheck.getLatestVersion()\n  .then(latestVersion =\u003e {\n    console.log(latestVersion);    // 0.1.2\n  });\n\nVersionCheck.getLatestVersion({\n    provider: 'appStore'  // for iOS\n  })\n  .then(latestVersion =\u003e {\n    console.log(latestVersion);    // 0.1.2\n  });\n\nVersionCheck.getLatestVersion({\n    provider: 'playStore'  // for Android\n  })\n  .then(latestVersion =\u003e {\n    console.log(latestVersion);    // 0.1.2\n  });\n\nVersionCheck.getLatestVersion()    // Automatically choose profer provider using `Platform.select` by device platform.\n  .then(latestVersion =\u003e {\n    console.log(latestVersion);    // 0.1.2\n  });\n\nVersionCheck.getLatestVersion({\n  forceUpdate: true,\n  provider: () =\u003e fetch('http://your.own/api')\n    .then(r =\u003e r.json())\n    .then(({version}) =\u003e version),   // You can get latest version from your own api.\n}).then(latestVersion =\u003e{\n  console.log(latestVersion);\n});\n\nVersionCheck.needUpdate()\n  .then(async res =\u003e {\n    console.log(res.isNeeded);    // true\n    if (res.isNeeded) {\n      Linking.openURL(res.storeUrl);  // open store if update is needed.\n    }\n  });\n\nVersionCheck.needUpdate({\n  depth: 2\n}).then(res =\u003e {\n  console.log(res.isNeeded);\n  // false; because first two fields of current and the latest versions are the same as \"0.1\".\n});\n\nVersionCheck.needUpdate({\n  currentVersion: \"1.0\",\n  latestVersion: \"2.0\"\n}).then(res =\u003e {\n  console.log(res.isNeeded);  // true\n});\n\nVersionCheck.needUpdate({\n  depth: 1,\n  currentVersion: \"2.1\",\n  latestVersion: \"2.0\",\n}).then(res =\u003e {\n  console.log(res.isNeeded);  // false\n});\n\n```\n\n## Methods\n\n- \u003ca name=\"getCountry\" href=\"#getCountry\"\u003e#\u003c/a\u003e**`getCountry()`** _(Promise\u003ccountry: String\u003e)_ - Returns device's country code of 2 characters.\n- \u003ca name=\"getPackageName\" href=\"#getPackageName\"\u003e#\u003c/a\u003e**`getPackageName()`** _(packageName: String)_ - Returns package name of app.\n- \u003ca name=\"getCurrentBuildNumber\" href=\"#getCurrentBuildNumber\"\u003e#\u003c/a\u003e**`getCurrentBuildNumber()`** _(buildNumber: Number)_ - Returns current app build number.\n- \u003ca name=\"getStoreUrl\" href=\"#getStoreUrl\"\u003e#\u003c/a\u003e**`getStoreUrl([option: Object])`** _(Promise\u003cstoreUrl: String\u003e)_ - Returns url of Play Market or App Store of app.\n- \u003ca name=\"getAppStoreUrl\" href=\"#getAppStoreUrl\"\u003e#\u003c/a\u003e**`getAppStoreUrl([option: Object])`** _(Promise\u003cstoreUrl: String\u003e)_ - Returns url of App Store of app.\n  - Option\n\n    Field | Type | Default\n    --- | --- | ---\n    appID | _string_ | App ID\n    ignoreErrors | _boolean_ | true\n- \u003ca name=\"getPlayStoreUrl\" href=\"#getPlayStoreUrl\"\u003e#\u003c/a\u003e**`getPlayStoreUrl([option: Object])`** _(Promise\u003cstoreUrl: String\u003e)_ - Returns url of Play Store of app.\n  - Option\n\n    Field | Type | Default\n    --- | --- | ---\n    packageName | _string_ | Package Name\n    ignoreErrors | _boolean_ | true\n\n- \u003ca name=\"getCurrentVersion\" href=\"#getCurrentVersion\"\u003e#\u003c/a\u003e**`getCurrentVersion()`** _(currentVersion: String)_ - Returns current app version.\n- \u003ca name=\"getLatestVersion\" href=\"#getLatestVersion\"\u003e#\u003c/a\u003e**`getLatestVersion([option: Object])`** _(Promise\u003clatestVersion: String\u003e)_ - Returns the latest app version parsed from url. Returns `null` when parsing error occurs.\n  - Option\n\n    Field | Type | Default\n    --- | --- | ---\n    forceUpdate | _boolean_ | ```false```\n    provider | _string_ or _function_ | provider name or function that returns promise or value of the latest version\n    fetchOptions | _object_ | isomorphic-fetch options (https://github.github.io/fetch/)\n    ignoreErrors | _boolean_ | true\n\n- \u003ca name=\"needUpdate\" href=\"#needUpdate\"\u003e#\u003c/a\u003e**`needUpdate([option: Object])`** _(Promise\u003cresult: Object\u003e)_ - Returns an object contains with boolean value whether update needed, current version and latest version. Current and the latest app versions are first split by delimiter, and check each split numbers into depth.\n  - Option\n\n    Field | Type | Default\n    --- | --- | ---\n    currentVersion | _string_ | app's current version from [getCurrentVersion()](#getCurrentVersion)\n    latestVersion | _string_ | app's latest version from [getLatestVersion()](#getLatestVersion)\n    depth | _number_ | ```Infinity```\n    forceUpdate | _boolean_ | ```false```\n    provider | _string_ or _function_ | provider name or function that returns promise or value of the latest version\n    fetchOptions | _object_ | isomorphic-fetch options (https://github.github.io/fetch/)\n    ignoreErrors | _boolean_ | true\n\n  - Result\n\n    Field | Type\n    --- | ---\n    isNeeded | _boolean_\n    storeUrl | _string_\n    currentVersion | _string_\n    latestVersion | _string_\n\n\n\n## License\nMIT\n\n\n[npm-image]: https://img.shields.io/npm/v/react-native-version-check.svg\n[npm-url]: https://npmjs.org/package/react-native-version-check\n[downloads-image]: https://img.shields.io/npm/dm/react-native-version-check.svg\n[downloads-url]: https://npmjs.org/package/react-native-version-check\n[ci-image]: https://circleci.com/gh/kimxogus/react-native-version-check.svg?style=svg\n[ci-url]: https://circleci.com/gh/kimxogus/react-native-version-check\n[dev-dependencies-image]: https://david-dm.org/kimxogus/react-native-version-check/dev-status.svg\n[dev-dependencies-url]: https://david-dm.org/kimxogus/react-native-version-check?type=dev\n[vulnerabilities-image]: https://snyk.io/test/github/kimxogus/react-native-version-check/badge.svg\n[vulnerabilities-url]: https://snyk.io/test/github/kimxogus/react-native-version-check\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkimxogus%2Freact-native-version-check","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkimxogus%2Freact-native-version-check","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkimxogus%2Freact-native-version-check/lists"}