Expo Constants provides system information that remains constant throughout the lifetime of your app. It offers comprehensive access to device information, app manifests, execution environment details, and platform-specific data across iOS, Android, and web platforms.
npx expo install expo-constantsimport Constants from "expo-constants";For accessing specific types:
import Constants, {
ExecutionEnvironment,
UserInterfaceIdiom,
AppOwnership,
type AndroidManifest,
type IOSManifest,
type PlatformManifest,
type WebManifest,
type ManifestAsset,
type Manifest,
type ManifestExtra,
type EASConfig,
type ClientScopingConfig,
type ExpoGoConfig,
type ExpoGoPackagerOpts
} from "expo-constants";CommonJS:
const Constants = require("expo-constants").default;import Constants from "expo-constants";
// Access system information
console.log("App name:", Constants.expoConfig?.name);
console.log("Version:", Constants.expoConfig?.version);
console.log("Device name:", Constants.deviceName);
console.log("Execution environment:", Constants.executionEnvironment);
// Check platform
if (Constants.platform?.ios) {
console.log("iOS version:", Constants.platform.ios.systemVersion);
} else if (Constants.platform?.android) {
console.log("Android version code:", Constants.platform.android.versionCode);
}
// Access session information
console.log("Session ID:", Constants.sessionId);
console.log("Linking URI:", Constants.linkingUri);Expo Constants is built around several key components:
ExponentConstants native module for platform-specific data accessCore system and device information that remains constant during app execution.
interface NativeConstants {
/** Module name (hidden) */
name: 'ExponentConstants';
/** App ownership status (deprecated, use executionEnvironment) */
appOwnership: AppOwnership | null;
/** Returns `true` when the app is running in debug mode */
debugMode: boolean;
/** A human-readable name for the device type */
deviceName?: string;
/** The device year class (deprecated, use expo-device) */
deviceYearClass: number | null;
/** Current execution environment */
executionEnvironment: ExecutionEnvironment;
/** Experience URL */
experienceUrl: string;
/** Expo runtime version */
expoRuntimeVersion: string | null;
/** Expo Go app version (null in bare workflow and web) */
expoVersion: string | null;
/** Detached status */
isDetached?: boolean;
/** Intent URI */
intentUri?: string;
/** Returns `true` if the app is running in headless mode */
isHeadless: boolean;
/** App linking URI */
linkingUri: string;
/** Unique session ID */
sessionId: string;
/** Default status bar height for the device */
statusBarHeight: number;
/** List of system font names available on the current device */
systemFonts: string[];
/** System version */
systemVersion?: number;
/** Supported Expo SDKs (hidden) */
supportedExpoSdks?: string[];
/** Get web view user agent string */
getWebViewUserAgentAsync(): Promise<string | null>;
}Access to app manifests and configuration data across different deployment scenarios.
interface Constants extends NativeConstants {
/** Legacy embedded manifest (deprecated, use expoConfig) - Dynamic getter */
manifest: EmbeddedManifest | null;
/** Modern Expo Updates manifest - Dynamic getter */
manifest2: ExpoUpdatesManifest | null;
/** Standard Expo config object from app.json/app.config.js - Dynamic getter */
expoConfig: (ExpoConfig & { hostUri?: string }) | null;
/** Expo Go specific configuration - Dynamic getter */
expoGoConfig: ExpoGoConfig | null;
/** EAS specific configuration - Dynamic getter */
easConfig: EASConfig | null;
/** Platform-specific manifest data */
platform?: PlatformManifest;
/** Internal manifest access without warning (for expo-asset) - Dynamic getter */
__unsafeNoWarnManifest?: EmbeddedManifest;
/** Internal manifest2 access without warning - Dynamic getter */
__unsafeNoWarnManifest2?: ExpoUpdatesManifest;
/** Test-only raw manifest access - Dynamic getter/setter */
__rawManifest_TEST?: RawManifest | null;
}enum ExecutionEnvironment {
/** Bare React Native app */
Bare = 'bare',
/** Standalone app */
Standalone = 'standalone',
/** Store client */
StoreClient = 'storeClient',
}enum UserInterfaceIdiom {
/** Phone interface */
Handset = 'handset',
/** Tablet interface */
Tablet = 'tablet',
/** Desktop interface */
Desktop = 'desktop',
/** TV interface */
TV = 'tv',
/** Unsupported interface (e.g., CarPlay) */
Unsupported = 'unsupported',
}enum AppOwnership {
/** Running inside Expo Go (deprecated, use ExecutionEnvironment) */
Expo = 'expo',
}interface PlatformManifest {
/** iOS-specific manifest */
ios?: IOSManifest;
/** Android-specific manifest */
android?: AndroidManifest;
/** Web-specific manifest */
web?: WebManifest;
/** Detach configuration */
detach?: {
scheme?: string;
[key: string]: any;
};
/** URL scheme */
scheme?: string;
/** Host URI */
hostUri?: string;
/** Developer information */
developer?: string;
}interface IOSManifest {
/** Build number from Info.plist CFBundleVersion */
buildNumber: string | null;
/** Apple internal model identifier (deprecated, use expo-device) */
platform: string;
/** Human-readable device model (deprecated, use expo-device) */
model: string | null;
/** User interface idiom (deprecated, use expo-device) */
userInterfaceIdiom: UserInterfaceIdiom;
/** iOS version (deprecated, use expo-device) */
systemVersion: string;
}interface AndroidManifest {
/** Version code from android.versionCode (deprecated, use expo-application) */
versionCode: number;
}type WebManifest = Record<string, any>;/** Embedded manifest interface */
interface EmbeddedManifest extends ExpoConfig {
id: string;
commitTime: number;
assets: any[];
// Legacy format for backwards compatibility
}
/** Expo Updates manifest interface */
interface ExpoUpdatesManifest {
id: string;
createdAt: string;
runtimeVersion: string;
launchAsset: ManifestAsset;
assets: ManifestAsset[];
metadata: object;
extra?: {
expoClient?: ExpoConfig;
expoGo?: ExpoGoConfig;
eas?: EASConfig;
};
}
/** Raw manifest union type for internal use */
type RawManifest = ExpoUpdatesManifest | EmbeddedManifest | ExpoConfig;/** Manifest asset type (from expo-manifests) */
type ManifestAsset = ManifestAssetForReExport;
/** Modern manifest type alias (same as ExpoUpdatesManifest) */
type Manifest = ExpoUpdatesManifest;
/** Manifest extra data type (from expo-manifests) */
type ManifestExtra = ManifestExtraForReExport;
/** EAS configuration type (from expo-manifests) */
type EASConfig = ManifestsEASConfig;
/** Client scoping configuration type (from expo-manifests) */
type ClientScopingConfig = ClientScopingConfigForReExport;
/** Expo Go configuration type (from expo-manifests) */
type ExpoGoConfig = ManifestsExpoGoConfig;
/** Expo Go packager options type (from expo-manifests) */
type ExpoGoPackagerOpts = ExpoGoPackagerOptsForReExport;/** Error thrown when manifest is unavailable in standalone/store environments */
interface ConstantsError extends Error {
code: 'ERR_CONSTANTS_MANIFEST_UNAVAILABLE';
message: string;
}Usage Examples:
import Constants, { ExecutionEnvironment } from "expo-constants";
try {
// Accessing manifest in different environments
const manifest = Constants.manifest;
if (Constants.executionEnvironment === ExecutionEnvironment.Bare) {
// In bare workflow, manifest can be null without error
// Warning may be logged to console
if (!manifest) {
console.log("Manifest not available in bare workflow");
}
} else if (
Constants.executionEnvironment === ExecutionEnvironment.Standalone ||
Constants.executionEnvironment === ExecutionEnvironment.StoreClient
) {
// In standalone/store environments, manifest should always exist
// Will throw CodedError if null
console.log("Manifest guaranteed to exist:", manifest);
}
} catch (error) {
if (error.code === 'ERR_CONSTANTS_MANIFEST_UNAVAILABLE') {
console.error("Manifest is unexpectedly unavailable:", error.message);
}
}Web Platform:
deviceName returns browser namesystemFonts returns empty array []statusBarHeight is always 0deviceYearClass is always nullprocess.env.APP_MANIFESTServer-Side Rendering:
"expo-constants/server"Dynamic Properties: The following properties are dynamic getters, not static values:
manifest, manifest2, expoConfig, expoGoConfig, easConfig__unsafeNoWarnManifest, __unsafeNoWarnManifest2__rawManifest_TEST (getter/setter for test environments)