• Stars
    star
    188
  • Rank 205,563 (Top 5 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 6 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🥕 Get the latest version of your app.

React Native Check Version

NPM GitHub license


An easy way to check if there's an update available for the current app in the App Store or Google Play.

Note that you need react-native-device-info to be installed for this library to function as expected, or you need to manually supply the bundleId and currentVersion values in the options object.

Installation

yarn add react-native-check-version react-native-device-info

Basic usage

Use the checkVersion method to get information:

import { checkVersion } from "react-native-check-version";

const version = await checkVersion();
console.log("Got version info:", version);

if (version.needsUpdate) {
   console.log(`App has a ${version.updateType} update pending.`);
}

API

Function usage

checkVersion() accepts an optional options object, which may contain the following keys:

  • string platform: platform to check for, defaults to React Native's Platform.OS
  • string country: App Store specific country, defaults to us
  • string bundleId: bundle identifier to check, defaults to the value retrieved using react-native-device-info
  • string currentVersion: version to check against, defaults to the currently installed version

Response object

checkVersion() returns a Promise, which when resolved will return an object with the following properties:

  • string version: latest version number of the app
  • string released: (iOS only) ISO 8601 release date of that version
  • string url: download URL for the latest version
  • string notes: (iOS only) release notes of latest version
  • boolean needsUpdate: whether the latest version number is higher than the currently installed one
  • string updateType: major, minor or patch, based on how big the difference is between the currently installed version and the available version

Changelog

  • v1.1.0: Use built-in fetch rather than Axios library.
  • v1.0.18: Update headers for Google Play HTTP request.
  • v1.0.14: Updated Android logic to use new Google Play endpoints.
  • v1.0.13: Added a try-catch within the main checkVersion function to prevent error responses from the HTTP requests to throw errors.
  • v1.0.12: Replaced the custom backend used previously by doing calls directly within the app. Please note Google Play has updated their web pages, making older versions not functional.

Authors

This library is developed by Flexible Agency, a creative app development agency.




Get professional support for this package →
Custom consulting sessions available for implementation support or feature development.

More Repositories

1

php-pkpass

💳 PHP class for creating passes for Wallet on iOS.
PHP
908
star
2

react-native-map-link

🗺 Open the map app of the user's choice.
TypeScript
651
star
3

react-native-email-link

📭 Open an email client from React Native (for 'magic link' type functionality).
JavaScript
390
star
4

db.php

🍎 Simple PHP class for doing standard MySQL actions, such as select, insert, update and delete rows.
PHP
103
star
5

lambda-sample-events

⚡️ A library of example event payloads for AWS Lambda.
JavaScript
48
star
6

react-native-keycode

🔢 Show the user a input form for a fixed-length code or password.
JavaScript
43
star
7

macaw

🦜 Scalable email templates for Node.js applications.
JavaScript
26
star
8

mapkit-jwt

🗺 Simple class to create MapKit and MusicKit JWT tokens.
PHP
18
star
9

react-native-confetti-view

JavaScript
9
star
10

things-stats

📊 Stats tool for Things.
JavaScript
6
star
11

csv-hero

🦸‍ The easiest tool to merge, filter and mangle CSV and JSON files.
JavaScript
5
star
12

jsnotebook

📘 Play around with Javascript in your browser and share notebooks.
JavaScript
5
star
13

todo-chrome-extensions

📩 Chrome extension to quickly add Gmail conversations as tasks in Things & OmniFocus.
JavaScript
5
star
14

tschoffelen

🌎 My personal website.
HTML
4
star
15

react-update-popup

🔄 Ask users to refresh when there is a new version of the app available.
TypeScript
4
star
16

things-gmail

📩 A Chrome extension to quickly add Gmail conversations as a task in Things.
JavaScript
3
star
17

serverless-starter

Starter boilerplate for a serverless API.
JavaScript
2
star
18

breakout-team

📹 Video breakout rooms made easy.
JavaScript
1
star
19

mirri

🌿 A little file sharing app.
JavaScript
1
star
20

gatsby-remark-fountain

Plugin to render Fountain screenwriting syntax in `gatsby-transformer-remark`.
JavaScript
1
star
21

advent-2020

🎅 My Advent of Code solutions.
JavaScript
1
star
22

alfred-schof.link

Alfred workflow to copy clipboard to schof.link.
JavaScript
1
star