An API that provides system information that remains constant throughout the lifetime of your app's installation.
GitHub
npm
expo-constants
provides system information that remains constant throughout the lifetime of your app's installation.
-
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.
import Constants from 'expo-constants';
AndroidManifest
AndroidManifest Properties
Name | Type | Description |
---|---|---|
versionCode | number |
The version code set by |
IOSManifest
IOSManifest Properties
Name | Type | Description |
---|---|---|
buildNumber | null | string | The build number specified in the embedded Info.plist value for |
model | null | string |
The human-readable model name of this device, e.g. |
platform | string |
The Apple internal model identifier for this device, e.g. |
systemVersion | string |
The version of iOS running on this device, e.g. |
userInterfaceIdiom | UserInterfaceIdiom |
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
Name | Type | Description |
---|---|---|
appOwnership | null | Expo | Returns |
debugMode | boolean | - |
deviceName (optional) | string | A human-readable name for the device type. |
deviceYearClass | null | number |
The device year class of this device. |
easConfig | null | EASConfig | The standard EAS config object populated when using EAS. |
executionEnvironment | ExecutionEnvironment | - |
experienceUrl | string | - |
expoConfig | null | ExpoConfig & {
hostUri: string
} | The standard Expo config object defined in |
expoGoConfig | null | ExpoGoConfig | The standard Expo Go config object populated when running in Expo Go. |
expoRuntimeVersion | null | string | - |
expoVersion | null | string | The version string of the Expo Go app currently running.
Returns |
getWebViewUserAgentAsync | () => Promise<null | string> | 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 |
intentUri (optional) | string | - |
isDetached (optional) | boolean | - |
isHeadless | boolean | - |
linkingUri | string | - |
manifest2 | null | ExpoUpdatesManifest | Manifest for Expo apps using modern Expo Updates from a remote source, such as apps that
use EAS Update. |
platform (optional) | PlatformManifest | - |
sessionId | string | 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. |
statusBarHeight | number | 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. |
systemFonts | string[] | A list of the system font names available on the current device. |
systemVersion (optional) | number | - |
PlatformManifest
PlatformManifest Properties
Name | Type | Description |
---|---|---|
android (optional) | AndroidManifest | - |
detach (optional) | {
scheme: string
} | - |
developer (optional) | string | - |
hostUri (optional) | string | - |
ios (optional) | IOSManifest | - |
scheme (optional) | string | - |
web (optional) | WebManifest | - |
AppOwnership
AppOwnership Values
ExecutionEnvironment
ExecutionEnvironment Values
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
.
UserInterfaceIdiom Values
Desktop
UserInterfaceIdiom.Desktop = "desktop"
Handset
UserInterfaceIdiom.Handset = "handset"
Tablet
UserInterfaceIdiom.Tablet = "tablet"
TV
UserInterfaceIdiom.TV = "tv"
Unsupported
UserInterfaceIdiom.Unsupported = "unsupported"