Expo Constants

GitHub

npm

An API that provides system information that remains constant throughout the lifetime of your app's installation.

Android
iOS
tvOS
Web

expo-constants provides system information that remains constant throughout the lifetime of your app's installation.

Installation

Terminal
npx expo install expo-constants

If you are installing this in an existing React Native app, start by installing expo in your project. Then, follow the additional instructions as mentioned by the library's README under "Installation in bare React Native projects" section.

API

import Constants from 'expo-constants';

Types

Android

AndroidManifest

Type: Record<string, any> extended by:


NameTypeDescription
versionCodenumber

Deprecated Use expo-application's Application.nativeBuildVersion.

The version code set by android.versionCode in app.json. The value is set to null in case you run your app in Expo Go.

Android
iOS
tvOS
Web

EASConfig

Type: ManifestsEASConfig

Android
iOS
tvOS
Web

ExpoGoConfig

Type: ManifestsExpoGoConfig

iOS

IOSManifest

Type: Record<string, any> extended by:


NameTypeDescription
buildNumberstring | null

The build number specified in the embedded Info.plist value for CFBundleVersion in this app. In a standalone app, you can set this with the ios.buildNumber value in app.json. This may differ from the value in Constants.expoConfig.ios.buildNumber because the manifest can be updated, whereas this value will never change for a given native binary. The value is set to null in case you run your app in Expo Go.

modelstring | null

Deprecated Moved to expo-device as Device.modelName.

The human-readable model name of this device. For example, "iPhone 7 Plus" if it can be determined, otherwise will be null.

platformstring

Deprecated Use expo-device's Device.modelId.

The Apple internal model identifier for this device.

Example

iPhone1,1

systemVersionstring

Deprecated Use expo-device's Device.osVersion.

The version of iOS running on this device.

Example

10.3

userInterfaceIdiomUserInterfaceIdiom

Deprecated Use expo-device's Device.getDeviceTypeAsync().

The user interface idiom of the current device, such as whether the app is running on an iPhone, iPad, Mac or Apple TV.

Android
iOS
tvOS
Web

Manifest

Type: ExpoUpdatesManifest

Android
iOS
tvOS
Web

ManifestAsset

Type: ManifestAssetForReExport

type re-exports to prevent breaking change

Android
iOS
tvOS
Web

NativeConstants

Type: Record<string, any> extended by:


NameTypeDescription
appOwnershipAppOwnership | null

Deprecated Use Constants.executionEnvironment instead.

Returns expo when running in Expo Go, otherwise null.

debugModeboolean

Returns true when the app is running in debug mode (__DEV__). Otherwise, returns false.

deviceName
(optional)
string

A human-readable name for the device type.

deviceYearClassnumber | null

Deprecated Moved to expo-device as Device.deviceYearClass.

The device year class of this device.

easConfigManifestsEASConfig | null

The standard EAS config object populated when using EAS.

executionEnvironmentExecutionEnvironment

Returns the current execution environment.

experienceUrlstring-
expoConfigExpoConfig & { hostUri: string } | null

The standard Expo config object defined in app.json and app.config.js files. For both classic and modern manifests, whether they are embedded or remote.

expoGoConfigManifestsExpoGoConfig | null

The standard Expo Go config object populated when running in Expo Go.

expoRuntimeVersionstring | null

Nullable only on the web.

expoVersionstring | null

The version string of the Expo Go app currently running. Returns null in bare workflow and web.

getWebViewUserAgentAsync() => Promise<string | null>

Gets the user agent string which would be included in requests sent by a web view running on this device. This is probably not the same user agent you might be providing in your JS fetch requests.

intentUri
(optional)
string-
isDetached
(optional)
boolean-
isHeadlessboolean

Returns true if the app is running in headless mode. Otherwise, returns false.

linkingUristring-
manifest2ExpoUpdatesManifest | null

Manifest for Expo apps using modern Expo Updates from a remote source, such as apps that use EAS Update. Constants.expoConfig should be used for accessing the Expo config object.

platform
(optional)
PlatformManifest

Returns the specific platform manifest object.

Note: This is distinct from the manifest and manifest2.

sessionIdstring

A string that is unique to the current session of your app. It is different across apps and across multiple launches of the same app.

statusBarHeightnumber

The default status bar height for the device. Does not factor in changes when location tracking is in use or a phone call is active.

systemFontsstring[]

A list of the system font names available on the current device.

systemVersion
(optional)
number-
Android
iOS
tvOS
Web

PlatformManifest

Type: Record<string, any> extended by:


NameTypeDescription
android
(optional)
AndroidManifest-
detach
(optional)
{ scheme: string }-
developer
(optional)
string-
hostUri
(optional)
string-
ios
(optional)
IOSManifest-
scheme
(optional)
string-
web
(optional)
WebManifest-
Web

WebManifest

Type: Record<string, any>

Enums

Android
iOS
tvOS
Web

AppOwnership

AppOwnership Values

Deprecated Use Constants.executionEnvironment instead.

Expo

AppOwnership.Expo = "expo"

The experience is running inside the Expo Go app.

Android
iOS
tvOS
Web

ExecutionEnvironment

ExecutionEnvironment Values

Bare

ExecutionEnvironment.Bare = "bare"

Standalone

ExecutionEnvironment.Standalone = "standalone"

StoreClient

ExecutionEnvironment.StoreClient = "storeClient"
Android
iOS
tvOS
Web

UserInterfaceIdiom

Current supported values are handset, tablet, desktop and tv. CarPlay will show up as unsupported.

UserInterfaceIdiom Values

Desktop

UserInterfaceIdiom.Desktop = "desktop"

Handset

UserInterfaceIdiom.Handset = "handset"

Tablet

UserInterfaceIdiom.Tablet = "tablet"

TV

UserInterfaceIdiom.TV = "tv"

Unsupported

UserInterfaceIdiom.Unsupported = "unsupported"