Skip to main content

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.

Important

Clerk reads your app's version with expo-application. Without it, in Expo Go, and on the web, the hook always reports the app as supported.

  • Name
    currentVersion
    Type
    string | null
    Description

    This build's version: its CFBundleShortVersionString on iOS and its versionCode on Android. null when Clerk can't read it, such as in Expo Go or without expo-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:

src/components/update-gate.tsx
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

What did you think of this content?

Last updated on