expo-modulepor expo

Guide for creating and writing Expo native modules and views using the Expo Modules API (Swift, Kotlin, TypeScript). Covers module definition DSL, native…

npx skills add https://github.com/expo/skills --skill expo-module

Writing Expo Modules

Complete reference for building native modules and views using the Expo Modules API. Covers Swift (iOS), Kotlin (Android), and TypeScript.

When to Use

  • Creating a new Expo native module or native view
  • Adding native functionality (camera, sensors, system APIs) to an Expo app
  • Wrapping platform SDKs for React Native consumption
  • Building config plugins that modify native project files
  • Adding Android, Apple, or web support to an existing Expo module
  • Editing expo-module.config.json, config plugins, or lifecycle hooks

References

Consult these resources as needed:

references/
  create-expo-module.md      Scaffolding and add-platform-support workflow, defaults, and quirks
  native-module.md           Module definition DSL: Name, Function, AsyncFunction, Property, Constant, Events, type system, shared objects
  native-view.md             Native view components: View, Prop, EventDispatcher, view lifecycle, ref-based functions
  lifecycle.md               Lifecycle hooks: module, iOS app/AppDelegate, Android activity/application listeners
  config-plugin.md           Config plugins: modifying Info.plist, AndroidManifest.xml, reading values in native code
  module-config.md           expo-module.config.json fields, file placement, and autolinking behavior

Quick Start

Prefer create-expo-module over manually creating native module files and directories. In practice, the best path is usually to create the scaffold first and then build on top of it. The scaffold sets up the expected layout, expo-module.config.json, podspec or Gradle files, TypeScript bindings, and the standalone example app flow.

If an existing Expo module only needs another platform, use create-expo-module add-platform-support instead of manually copying native directories.

See references/create-expo-module.md before scaffolding or extending a module. It covers:

  • local vs standalone modules
  • --platform, --features, --barrel, --package-manager, and non-interactive mode
  • expo.autolinking.nativeModulesDir
  • add-platform-support behavior and quirks

Recommended Workflow

  1. Choose the scaffold type first:
    • Local module for one app
    • Standalone module for reuse, monorepos, or publishing
  2. Determine native expo-module features that you will need.
    • Based on the user's instructions determine which feature scaffolding will be useful.
    • Available features: Constant, Function, AsyncFunction, Event, View,ViewEvent, SharedObject
  3. Scaffold deliberately:
    • pass an explicit slug or path
    • choose --platform intentionally instead of relying on defaults
    • use --features to choose code samples which you will modify in the next stepto match the real implementation.
  4. Replace generated example code with the real implementation.
  5. If you add a new platform later, prefer add-platform-support over manual file copying.

Practical Scaffolding Rules

  • Feature examples are opt-in. A newly scaffolded module may be minimal if no features were selected.
  • ViewEvent implies View.
  • Local modules do not generate an index.ts barrel by default. Use --barrel only if you want one.
  • In non-interactive local scaffolding, pass the positional slug or path explicitly. --name changes the native class name, not the folder name.
  • Local modules live in expo.autolinking.nativeModulesDir when configured, otherwise in modules/.
  • Standalone modules have their own package metadata, scripts, and usually an example app. Local modules use the host app's tooling instead.

Core File Shapes

The Swift and Kotlin DSL share the same structure. Swift is usually the clearest primary example; consult the references for feature-specific details.

Module Structure Reference

The Swift and Kotlin DSL share the same structure. Both platforms are shown here for reference — in other reference files, Swift is shown as the primary language unless the Kotlin pattern meaningfully differs.

Swift (iOS):

import ExpoModulesCore

public class MyModule: Module {
  public func definition() -> ModuleDefinition {
    Name("MyModule")

    Function("hello") { (name: String) -> String in
      return "Hello \(name)!"
    }
  }
}

Kotlin (Android):

package expo.modules.mymodule

import expo.modules.kotlin.modules.Module
import expo.modules.kotlin.modules.ModuleDefinition

class MyModule : Module() {
  override fun definition() = ModuleDefinition {
    Name("MyModule")

    Function("hello") { name: String ->
      "Hello $name!"
    }
  }
}

TypeScript:

import { requireNativeModule } from "expo";

const MyModule = requireNativeModule("MyModule");

export function hello(name: string): string {
  return MyModule.hello(name);
}

expo-module.config.json

{
  "platforms": ["android", "apple"],
  "apple": {
    "modules": ["MyModule"]
  },
  "android": {
    "modules": ["expo.modules.mymodule.MyModule"]
  }
}

Note: iOS uses just the class name; Android uses the fully-qualified class name (package + class). See references/module-config.md for all fields.

Mais skills de expo

android-e2e-testing
by expo
Test Expo Router features on Android emulators using ADB. Use after implementing native Android features or when verifying UI behavior on Android.
deep-code-review
by expo
In-depth design-focused code review - understands codebase context before evaluating PR changes, posts structured feedback to GitHub
building-native-ui
by expo
Complete guide for building native Expo apps with routing, styling, components, and platform conventions. Covers Expo Router fundamentals, native tabs, stack navigation, modals, and form sheets with detailed route structure conventions Includes styling rules aligned with Apple Human Interface Guidelines: flexbox layouts, safe area handling, animations, shadows via CSS boxShadow , and responsive design patterns Documents library preferences (expo-image for SF Symbols, expo-audio, expo-video,...
eas-update-insights
by expo
Check the health of published EAS Updates: crash rates, install/launch counts, unique users, payload size, and the split between embedded and OTA users per…
expo-api-routes
by expo
API routes in Expo Router for server-side logic, secrets, and third-party integrations on EAS Hosting. Create routes with +api.ts suffix in the app directory; export named functions for HTTP methods (GET, POST, PUT, DELETE) Handle query parameters, headers, JSON bodies, and dynamic route segments; add CORS headers for web clients Access server-side secrets via process.env ; set variables locally in .env or via eas env:create for production Deploy to EAS Hosting (Cloudflare Workers) with eas...
expo-cicd-workflows
by expo
Write and validate EAS CI/CD workflow YAML files for Expo projects. Fetches the latest JSON schema from Expo's API to ensure job types, parameters, triggers, and runner configurations are current Supports dynamic expressions using ${{ }} syntax with contexts for GitHub events, workflow inputs, job outputs, and step results Includes built-in validation script that checks workflow structure against the schema and reports errors before deployment Provides reference documentation for syntax,...
expo-deployment
by expo
Automated deployment of Expo apps to iOS App Store, Android Play Store, web hosting, and preview environments. Supports production builds and submissions for iOS (App Store and TestFlight) and Android (Google Play Store) with single commands Includes EAS Hosting for web deployments with automatic PR preview URLs and production domain support Provides CI/CD workflow automation via EAS Workflows for triggered builds and submissions on code pushes Automatic version management with remote...
expo-dev-client
by expo
Build custom Expo development clients for testing native code on physical devices via EAS Build or locally. Only needed when using custom native modules, Apple targets (widgets, app clips), or third-party native code not in Expo Go; try Expo Go first with npx expo start Supports cloud builds with automatic TestFlight submission or local builds on your machine, outputting .ipa (iOS) or .apk / .aab (Android) files Requires eas.json configuration with a development profile that sets...

NotebookLM Web Importer

Importe páginas da web e vídeos do YouTube para o NotebookLM com um clique. Confiado por mais de 200.000 usuários.

Instalar extensão do Chrome