Expo Constants

GitHub

npm

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


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

Platform Compatibility

Android DeviceAndroid EmulatoriOS DeviceiOS SimulatorWeb

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';

Interfaces

AndroidManifest

AndroidManifest Properties

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.


IOSManifest

IOSManifest Properties

NameTypeDescription
buildNumbernull | string

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.

modelnull | string

Deprecated Moved to expo-device as Device.modelName.

The human-readable model name of this device, e.g. "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, e.g. iPhone1,1.

systemVersionstring

Deprecated Use expo-device's Device.osVersion.

The version of iOS running on this device, e.g. 10.3.

userInterfaceIdiomUserInterfaceIdiom

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

The user interface idiom of this device, i.e. whether the app is running on an iPhone, iPad, Mac or Apple TV.


NativeConstants

NativeConstants Properties

NameTypeDescription
appOwnershipnull | AppOwnership

Returns expo, standalone, or guest. This property only applies to the managed workflow and classic builds; for apps built with EAS Build and in bare workflow, the result is always null.

debugModeboolean-
deviceName
(optional)
string

A human-readable name for the device type.

deviceYearClassnull | number

Deprecated Moved to expo-device as Device.deviceYearClass.

The device year class of this device.

easConfignull | EASConfig

The standard EAS config object populated when using EAS.

executionEnvironmentExecutionEnvironment-
experienceUrlstring-
expoConfignull | ExpoConfig & { hostUri: string }

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.

expoGoConfignull | ExpoGoConfig

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

expoRuntimeVersionnull | string-
expoVersionnull | string

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

getWebViewUserAgentAsync() => Promise<null | string>-
installationIdstring

Deprecated Constants.installationId is deprecated in favor of generating your own ID and storing it.

An identifier that is unique to this particular device and whose lifetime is at least as long as the installation of the app.

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

Deprecated Use expo-device's Device.isDevice.

true if the app is running on a device, false if running in a simulator or emulator.

isHeadlessboolean-
linkingUristring-
manifestnull | BareManifest

Deprecated Use Constants.expoConfig instead, which behaves more consistently across EAS Build and EAS Update.

Classic manifest for Expo apps using classic updates and the updates embedded in builds. Returns null in bare workflow and when manifest2 is non-null.

manifest2null | NewManifest

Manifest for Expo apps using modern Expo Updates from a remote source, such as apps that use EAS Update. Returns null in bare workflow and when manifest is non-null. Constants.expoConfig should be used for accessing the Expo config object.

nativeAppVersionnull | string

Deprecated Use expo-application's Application.nativeApplicationVersion.

The Info.plist value for CFBundleShortVersionString on iOS and the version name set by version in app.json on Android at the time the native app was built.

nativeBuildVersionnull | string

Deprecated Use expo-application's Application.nativeBuildVersion.

The Info.plist value for CFBundleVersion on iOS (set with ios.buildNumber value in app.json in a standalone app) and the version code set by android.versionCode in app.json on Android at the time the native app was built.

platform
(optional)
PlatformManifest-
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-

PlatformManifest

PlatformManifest Properties

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

Types

ClientScopingConfig

Type: ClientScopingConfigForReExport

EASConfig

Type: ManifestsEASConfig

ExpoGoConfig

Type: ManifestsExpoGoConfig

ExpoGoPackagerOpts

Type: ExpoGoPackagerOptsForReExport

Manifest

Type: NewManifest

ManifestAsset

Type: ManifestAssetForReExport

ManifestExtra

Type: ManifestExtraForReExport

Enums

AppOwnership

Expo

AppOwnership.Expo = "expo"

The experience is running inside of the Expo Go app.

Guest

AppOwnership.Guest = "guest"

It has been opened through a link from a standalone app.

Standalone

AppOwnership.Standalone = "standalone"

It is a standalone app.

ExecutionEnvironment

Bare

ExecutionEnvironment.Bare = "bare"

Standalone

ExecutionEnvironment.Standalone = "standalone"

StoreClient

ExecutionEnvironment.StoreClient = "storeClient"

UserInterfaceIdiom

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

Desktop

UserInterfaceIdiom.Desktop = "desktop"

Handset

UserInterfaceIdiom.Handset = "handset"

Tablet

UserInterfaceIdiom.Tablet = "tablet"

TV

UserInterfaceIdiom.TV = "tv"

Unsupported

UserInterfaceIdiom.Unsupported = "unsupported"