Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@arelstone/react-native-version-checker

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@arelstone/react-native-version-checker

Pure Javascript implementation to check if you got a new app version available

  • 1.0.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
increased by500%
Maintainers
1
Weekly downloads
 
Created
Source

@arelstone/react-native-versionchecker

npm (scoped) npm GitHub issues GitHub pull requests

Ever needed to check if your app is up to date? No fear, react-native-version-checker is here!

This is a pure javascript implementation, so it will work with both pure react native and expo

Installation

Yarn:

yarn add @arelstone/react-native-version-checker

npm:

npm install @arelstone/react-native-version-checker

Usage

import { View, Button, Alert, Linking } from 'react-native';
import { VersionChecker } from '@arelstone/react-native-version-checker'


const defaults = {
    packageName: 'com.facebook.katana',
    countryCode: 'da', // You can get this from DeviceInfo or something similar
}

const latestVersion = async () => {
    const { version } = await VersionChecker.getLatestVersion(defaults);

    return console.log(
        'VersionChecker',
        `Latest version in the store is ${version}`,
    );
};

const needsUpdate = async () => {
    const { currentVersion, updateNeeded, url, version } = await VersionChecker.needsUpdate(
        '2.2.24', // This could come from DeviceInfo or something similar
        defaults,
    );

    if (updateNeeded) {
        Alert.alert(
            'VersionChecker',
            `You need to update the app. You are running ${currentVersion}. The lastest version is ${version}`,
            [{
                onPress: () => Linking.canOpenURL(url).then(yes => {
                    if (!yes) { return 'Could not open the store'; }
                    
                    return Linking.openURL(url);
                }),
            }],
        );
    }
};

Contributing

Open source development is all about contributions. If you feel that something is missing, feel free to submit a pull request.

FAQs

Package last updated on 12 Apr 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc