Skip to main content

Migration from react-native-version-check

This library is a drop-in replacement for react-native-version-check. Here's how to migrate.

1. Swap packages

Remove the old package and install the new one:

# Remove old
npm uninstall react-native-version-check

# Install new
bun add react-native-nitro-version-check react-native-nitro-modules

2. Update imports

import VersionCheck from 'react-native-version-check'
import { VersionCheck } from 'react-native-nitro-version-check'

3. API changes

Most APIs are the same or simpler. Key differences:

Sync vs Async

The old library required async calls for basic info. This library caches everything at module init:

const version = await VersionCheck.getCurrentVersion()
const version = VersionCheck.version // sync!

const buildNumber = await VersionCheck.getCurrentBuildNumber()
const buildNumber = VersionCheck.buildNumber // sync!

const packageName = await VersionCheck.getPackageName()
const packageName = VersionCheck.packageName // sync!

Update checking

const update = await VersionCheck.needUpdate()
if (update.isNeeded) { ... }
if (await needsUpdate()) { ... }

// Granular update level (new!)
if (await needsUpdate({ level: 'major' })) { ... }

Country code

const country = await VersionCheck.getCountry()
const country = getCountry() // sync!

4. New features

These are new and have no equivalent in the old library:

FeatureAPI
Install source detectionVersionCheck.installSource
Granular update levelsneedsUpdate({ level: 'major' })
Version comparison utilitycompareVersions(v1, v2)

5. Rebuild

For Expo:

npx expo prebuild --clean

For bare React Native:

cd ios && pod install