The Expo SDK provides a comprehensive set of libraries and tools for building cross-platform mobile applications using React Native.
npx @tessl/cli install tessl/npm-expo@53.0.0Expo is an open-source platform for making universal native apps that run on Android, iOS, and the web. The Expo SDK provides a comprehensive set of libraries and tools that enable developers to build cross-platform mobile applications using React Native and JavaScript/TypeScript. It includes core functionality for asset management, file system access, font loading, hardware features, native module management, development tools integration, and polyfills for modern web APIs.
npm install expoimport {
registerRootComponent,
isRunningInExpoGo,
EventEmitter,
requireNativeModule,
useEvent
} from "expo";For CommonJS:
const {
registerRootComponent,
isRunningInExpoGo,
EventEmitter,
requireNativeModule,
useEvent
} = require("expo");// DevTools integration
import { DevToolsPluginClient } from "expo/devtools";
// Configuration utilities
import * as Config from "expo/config";
// Configuration plugins
import * as ConfigPlugins from "expo/config-plugins";
// Custom fetch implementation
import { fetch } from "expo/fetch";
// Project fingerprinting
import * as Fingerprint from "expo/fingerprint";
// Metro bundler configuration
import * as MetroConfig from "expo/metro-config";import React from 'react';
import { View, Text } from 'react-native';
import { registerRootComponent, isRunningInExpoGo, requireNativeModule } from 'expo';
// Basic app component
function App() {
const inExpoGo = isRunningInExpoGo();
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<Text>Hello Expo!</Text>
<Text>Running in Expo Go: {inExpoGo ? 'Yes' : 'No'}</Text>
</View>
);
}
// Register as root component
registerRootComponent(App);
// Access native modules
const Constants = requireNativeModule('expo-constants');
console.log('App version:', Constants.appVersion);The Expo SDK is built around several key architectural components:
Core functionality for registering and managing the root application component and handling app lifecycle.
function registerRootComponent(component: React.ComponentType<any>): void;
function disableErrorHandling(): void;Utilities for detecting the runtime environment and accessing platform-specific configuration.
function isRunningInExpoGo(): boolean;
function getExpoGoProjectConfig(): ExpoGoProjectConfig | null;
interface ExpoGoProjectConfig {
projectUrl?: string;
debuggerHost?: string;
mainModuleName?: string;
}Comprehensive system for loading, managing, and interacting with native modules across platforms.
function requireNativeModule<T>(moduleName: string): T;
function requireOptionalNativeModule<T>(moduleName: string): T | null;
function requireNativeView(viewName: string): any;
function registerWebModule(moduleName: string, moduleImplementation: any): void;
function reloadAppAsync(): Promise<void>;Type-safe event emitter system for native module communication and React hooks for event handling.
class EventEmitter<TEventsMap = Record<string, any>> {
addListener<EventName extends keyof TEventsMap>(
eventName: EventName,
listener: (event: TEventsMap[EventName]) => void
): Subscription;
removeAllListeners<EventName extends keyof TEventsMap>(eventName?: EventName): void;
emit<EventName extends keyof TEventsMap>(
eventName: EventName,
event: TEventsMap[EventName]
): void;
}
function useEvent<T>(
eventEmitter: EventEmitter<any>,
eventName: string,
listener: (event: T) => void
): void;
function useEventListener<T>(
eventEmitter: EventEmitter<any>,
eventName: string,
listener: (event: T) => void
): void;Plugin-based development tools system for debugging, logging, and development workflow integration.
class DevToolsPluginClient {
addMessageListener(listener: (message: any) => void): EventSubscription;
sendMessage(message: any): void;
closeAsync(): Promise<void>;
isConnected(): boolean;
}
function getDevToolsPluginClientAsync(
pluginName: string,
options?: DevToolsPluginClientOptions
): Promise<DevToolsPluginClient>;System for creating DOM components that run within WebView contexts for hybrid React Native/web functionality.
function registerDOMComponent(AppModule: any): void;
function useDOMImperativeHandle<T extends DOMImperativeFactory>(
ref: Ref<T>,
init: () => T,
deps?: DependencyList
): void;
const IS_DOM: boolean;Modern web API implementations providing consistent behavior across React Native and web platforms.
function fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
class Headers implements Headers { }
class Request implements Request { }
class Response implements Response { }
class URL { }
class URLSearchParams { }
class TextDecoder { }
class TextEncoder { }
class FormData { }Helper functions for blob conversion and binary data processing.
function blobToArrayBufferAsync(blob: Blob): Promise<ArrayBuffer>;
function legacyBlobToArrayBufferAsync(blob: Blob): Promise<ArrayBuffer>;// Base classes
class SharedObject { }
class SharedRef<T> { }
class NativeModule { }
// Event system types
interface Subscription {
remove(): void;
}
interface EventSubscription extends Subscription {
eventName: string;
key: string;
}
// DevTools types
interface DevToolsPluginClientOptions {
requestInterceptor?: (request: any) => any;
responseInterceptor?: (response: any) => any;
}
// Configuration types
interface ExpoGoProjectConfig {
projectUrl?: string;
debuggerHost?: string;
mainModuleName?: string;
}The Expo SDK includes 100+ bundled native modules that can be accessed through the native module system:
These modules are pre-configured and ready to use through the requireNativeModule and requireOptionalNativeModule functions.