useAppVersionSupport()
The useAppVersionSupport() hook reports whether your app's version meets the minimum set for it in the Clerk Dashboard, and updates when that changes. When the version is unsupported, Clerk rejects most of the app's requests until the user updates.
<ClerkProvider> shows an update screen automatically while the version is unsupported. Use this hook when you set updateRequiredViewEnabled to false on <ClerkProvider> to show your own update screen instead. To set a minimum version, see Require a minimum app version.
- Name
currentVersion- Type
string | null- Description
This build's version: its
CFBundleShortVersionStringon iOS and itsversionCodeon Android.nullwhen Clerk can't read it, such as in Expo Go or withoutexpo-application.
- Name
isSupported- Type
boolean- Description
Whether this version of the app is supported. When it's
false, Clerk rejects most of the app's requests until the user updates.
- Name
minimumVersion- Type
string | null- Description
The oldest supported version, when a minimum is set for this app.
- Name
updateUrl- Type
string | null- Description
The store page that users open to update the app.
How to use the useAppVersionSupport() hook
The following example shows an update screen while the app's version is unsupported, and the app's content otherwise:
import { useAppVersionSupport } from '@clerk/expo'
import type { ReactNode } from 'react'
import { Button, Linking, Text, View } from 'react-native'
export function UpdateGate({ children }: { children: ReactNode }) {
const { isSupported, updateUrl } = useAppVersionSupport()
if (isSupported) {
return children
}
return (
<View>
<Text>Update required</Text>
{updateUrl && <Button title="Update" onPress={() => Linking.openURL(updateUrl)} />}
</View>
)
}Feedback
Last updated on