or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

devtools.mddom-components.mdindex.mdnative-modules.mdutilities.mdwinter-polyfills.md
tile.json

index.mddocs/

Expo SDK

Expo 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.

Package Information

  • Package Name: expo
  • Package Type: npm
  • Language: TypeScript
  • Installation: npm install expo

Core Imports

import { 
  registerRootComponent,
  isRunningInExpoGo,
  EventEmitter,
  requireNativeModule,
  useEvent
} from "expo";

For CommonJS:

const { 
  registerRootComponent,
  isRunningInExpoGo,
  EventEmitter,
  requireNativeModule,
  useEvent
} = require("expo");

Secondary Entry Points

// 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";

Basic Usage

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

Architecture

The Expo SDK is built around several key architectural components:

  • Core Module System: Native module registration, loading, and management with type-safe APIs
  • Cross-Platform Runtime: Unified APIs that work across iOS, Android, and web platforms
  • Development Tools: Integrated DevTools plugin system for debugging and development workflows
  • Polyfill Layer: Modern web API implementations (fetch, URL, TextEncoder/Decoder) for consistent behavior
  • DOM Bridge: Web component system allowing DOM integration in React Native apps
  • Configuration System: Project configuration and plugin architecture for extending functionality

Capabilities

App Registration and Lifecycle

Core functionality for registering and managing the root application component and handling app lifecycle.

function registerRootComponent(component: React.ComponentType<any>): void;
function disableErrorHandling(): void;

Environment Detection

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

Native Module System

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

Native Module System

Event System

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;

DevTools Integration

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

DevTools System

DOM Components

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;

DOM Components

Winter Polyfills

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 { }

Winter Polyfills

Utilities

Helper functions for blob conversion and binary data processing.

function blobToArrayBufferAsync(blob: Blob): Promise<ArrayBuffer>;
function legacyBlobToArrayBufferAsync(blob: Blob): Promise<ArrayBuffer>;

Utilities

Core Types

// 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;
}

Bundled Native Modules

The Expo SDK includes 100+ bundled native modules that can be accessed through the native module system:

Core Modules

  • expo-asset: Asset management and loading
  • expo-constants: App and device constants
  • expo-file-system: File system access and operations
  • expo-font: Font loading and management
  • expo-keep-awake: Prevent device sleep functionality

Additional Modules

  • @expo/vector-icons: Comprehensive icon libraries
  • react-native-edge-to-edge: Edge-to-edge display support
  • Plus 90+ additional modules for camera, location, notifications, sensors, and more

These modules are pre-configured and ready to use through the requireNativeModule and requireOptionalNativeModule functions.