Use the needsUpdate() function to check if a newer version is available in the store:
1
Import update functions
import { needsUpdate, getStoreUrl } from 'react-native-nitro-version-check'import { Linking } from 'react-native'
2
Check for updates
Call needsUpdate() to perform a semantic version comparison:
if (await needsUpdate()) { const url = await getStoreUrl() Linking.openURL(url)}
This checks if any version increase is available (patch, minor, or major).
3
Filter by update level
You can specify the granularity of updates to check for:
// Only prompt for major updates (1.x → 2.x)const majorUpdate = await needsUpdate({ level: "major" })// Check for major or minor updatesconst minorUpdate = await needsUpdate({ level: "minor" })// Check for any update (default)const anyUpdate = await needsUpdate({ level: "patch" })
import { VersionCheck } from 'react-native-nitro-version-check'if (VersionCheck.installSource === "testflight") { console.log("Running a TestFlight build")} else if (VersionCheck.installSource === "appstore") { console.log("Running an App Store build")} else if (VersionCheck.installSource === "playstore") { console.log("Running a Play Store build")} else { console.log("Dev build or sideloaded")}
Install source is undefined for development builds and sideloaded apps. Use this to show different UI or features based on where the app came from.