Skip to main content
The expo package is the core of the Expo SDK, providing essential functionality for Expo applications.

Installation

Overview

The expo package serves as the entry point for Expo applications and provides:
  • Core module APIs (EventEmitter, SharedObject, NativeModule)
  • Root component registration
  • Development tools integration
  • Native module access utilities
  • React hooks for event handling

Main Exports

registerRootComponent

Sets the initial React component to render natively in your app’s root React Native view on Android, iOS, tvOS and web.
ComponentType<P>
required
The React component class that renders the rest of your app.
What it does:
  • Invokes React Native’s AppRegistry.registerComponent
  • On web, invokes AppRegistry.runApplication to render to the root index.html file
  • Polyfills the process.nextTick function globally
  • In development, adds Fast Refresh and bundle splitting indicators
  • In development, validates expo-updates configuration
Usage:
This is typically used in your index.js or App.js file as the entry point.

Core Classes

These classes are re-exported from expo-modules-core for convenience.

EventEmitter

A class for objects that emit events. Native modules and shared objects can extend this class to provide event emitting capabilities.

SharedObject

Represents an instance of a native shared object that can be passed between different independent libraries. Allows for sharing native object instances across the JSI boundary.

SharedRef

A mutable ref that can hold a reference to a shared object and allows for updating that reference across the native boundary.

NativeModule

Base class for native modules to inherit from, providing the foundation for Expo’s module system.

Module Access Functions

requireNativeModule

Imports a native module registered with the given name.
string
required
Name of the requested native module.
ModuleType
Object representing the native module.
Throws an error if the native module cannot be found.

requireOptionalNativeModule

Same as requireNativeModule, but returns null when the module cannot be found instead of throwing an error.
string
required
Name of the requested native module.
ModuleType | null
Object representing the native module or null if not found.

requireNativeView

Requires a native view manager for creating native UI components.

registerWebModule

Registers a web implementation for a native module, allowing for platform-specific implementations.

React Hooks

useEvent

React hook that listens to events emitted by an object and returns the latest event parameter.
EventEmitter<TEventsMap>
required
An object that emits events (native module, shared object, or EventEmitter instance).
string
required
Name of the event to listen to.
any
default:"null"
Initial value to use until the first event is received.

useEventListener

React hook that listens to events and calls a listener function whenever a new event is dispatched.
EventEmitter<TEventsMap>
required
An object that emits events.
string
required
Name of the event to listen to.
Function
required
Function to call when the event is dispatched.

Utility Functions

reloadAppAsync

Reloads the app, similar to refreshing a web page.

disableErrorHandling

Disables Expo’s error handling overlay (useful for custom error boundaries).

isRunningInExpoGo

Checks if the app is running inside Expo Go.
boolean
true if running in Expo Go, false otherwise.

getExpoGoProjectConfig

Gets the project configuration when running in Expo Go.

Worklets

installOnUIRuntime

Installs a worklet on the UI runtime for use with react-native-reanimated.

Included Dependencies

The expo package includes several core dependencies:
  • expo-asset - Asset system for managing and loading assets
  • expo-constants - System and app constants
  • expo-file-system - File system access
  • expo-font - Custom font loading
  • expo-keep-awake - Prevents the screen from sleeping
  • @expo/vector-icons - Icon library

CLI Integration

The expo package includes the Expo CLI as a dependency. When you install expo, you get access to:
See the CLI Reference for complete documentation.

Metro Configuration

The package provides a Metro configuration helper:
See Metro Config Reference for more details.

TypeScript

The expo package includes full TypeScript definitions. Import types from expo-modules-core/types:

Source Code

View the source code on GitHub: