Axonpack

Reference

Every function, option, result field, error and export.

Use this page to look up a name, an option or an error. If you are new, start with the Quick start.

Functions

All are named exports, and also on the default export (VersionCheck).

FunctionReturns
needUpdate(options?)The result
getLatestVersion(options?)The newest version string
getStoreUrl(options?)The store link for the current platform
getAppStoreUrl(options?)The App Store link. appID is optional: it is looked up
getPlayStoreUrl(options?)The Play Store link
getCountry()The country from the version source
getPackageName()The bundle id or application id
getCurrentVersion()The installed version
getCurrentBuildNumber()The build number: the versionCode (a number) on Android, the CFBundleVersion (a string) on iOS
openStore(options?)Opens the store page. Falls back to https on iOS
clearCache()Forgets stored answers
setVersionInfo(source)Replaces where the app's version comes from
evaluateUpdate(version, provided, options?)The decision only, with no request

With ignoreErrors: false each of these that can fail returns a value that is never undefined.

needUpdate options

OptionDefaultWhat it does
providerby platform'appStore', 'playStore', a provider, or a function
platformthe device'ios' or 'android'
countrythe deviceStorefront for the App Store lookup
fallbackCountry'us'Tried when the app is not in country
packageNamethe app'sBundle id or application id
currentVersionthe app'sCompare as if this were installed
latestVersionlooked upSkip the lookup, and use this
minimumVersionprovider'sVersions below it are forced
requiredfalsetrue, 'major', 'minor', 'patch', or (result) => boolean
canSkiptruefalse removes skip for soft updates
skipVersionnoneA soft update to exactly this version is muted
depthallCompare only this many parts
comparebuilt inYour own ordering. See Version formats
currentBuildNumber, latestBuildNumberBuild tiebreak when the versions match. See Version formats
storeUrlnoneUsed when latestVersion is given and no provider is asked
mocknoneFake a release. Ignored unless __DEV__
ignoreErrorstrueWarn and resolve undefined, instead of throwing
timeoutMs, retries, retryDelayMs, signal, cacheTtlMs, forceUpdate, fetch, fetchOptionsSee Providers

The result

FieldMeaning
isNeededShow something: a forced update, or a soft one that is not skipped
isForcedBelow minimumVersion, or caught by required
isSkippedA soft update the user skipped
canSkipFalse when forced, or when canSkip: false
updateTypemajor, minor, patch, prerelease, build or none
currentVersion, latestVersion, minimumVersionThe versions
storeUrlWhere to send the user
releaseNotes, releaseDateFrom the store, when it has them
currentBuildNumber, latestBuildNumberSet when updateType is build: the two build numbers

useVersionCheck(options)

Takes every needUpdate option, plus enabled, refreshOnForeground, skipStorage and skipStorageKey. Returns:

FieldMeaning
isLoading, errorCheck state
resultThe result, or undefined until it arrives
isNeeded, isForcedShortcuts to the result
storeUrl, latestVersion, currentVersion, releaseNotesShortcuts to the result
refresh()Check again now
skipVersion()Mute the current soft update
openStore()Open the store

<UpdatePrompt /> props

Every hook option, plus:

PropMeaning
componentYour own modal. See Your own modal
themePartial tokens. See Theming
labelsPartial strings
iconContent of the round badge
notesExpandedStart with the release notes open
nativeUpdateOn Android, update through Google's own update screen. Falls back to the store link
onUpdateReplaces what Update does
childrenRendered while there is nothing to show

Errors

All extend VersionCheckError, which has a code.

ClasscodeWhen
NetworkErrorNETWORKThe request failed
TimeoutErrorTIMEOUTIt took longer than timeoutMs
AbortedErrorABORTEDYour signal was aborted
HttpErrorHTTPA non-2xx answer. Has status
ParseErrorPARSEThe page or JSON had no readable version
NotFoundErrorNOT_FOUNDThe store has no listing for the app
InvalidVersionErrorINVALID_VERSIONA version the comparison cannot read
InvalidProviderErrorINVALID_PROVIDERThe provider option is not one
VersionInfoUnavailableErrorUNAVAILABLENo version source, or a missing optional module
UnsupportedPlatformErrorUNSUPPORTED_PLATFORMNo default provider for this platform (web)

Other exports

checkOtaUpdate and applyOtaUpdate check for and apply an Expo over-the-air update (a new JavaScript bundle without a store release). They need expo-updates.

createVersionCheck, detectCountry, createDefaultSource, appStore, playStore, jsonProvider, chain, providers, setMockVersion, isDev, checkOtaUpdate, applyOtaUpdate, getNativeUpdateInfo, startNativeUpdate, completeNativeUpdate, isNativeUpdateSupported, UpdatePrompt, DefaultUpdateModal, LIGHT_THEME, DARK_THEME, DEFAULT_LABELS, resolveTheme, the version helpers, and the types.

On this page