skill

Expo Module

Expo0+ تثبيتموثوق

نبذة

# 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

To migrate an existing Swift module from the definition DSL to the Expo Modules API 2.0 macros (`@ExpoModule`, `@JS`, `@Event`), use the `expo-migrate-module` skill (from the `expo-experiments` plugin) instead.

## 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](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 step to 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):**

```swift import ExpoModulesCore

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

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

**Kotlin (Android):**

```kotlin 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:**

```typescript import { requireNativeModule } from "expo";

const MyModule = requireNativeModule("MyModule");

export funct

التثبيت

شغل هذا الأمر

git clone https://github.com/expo/skills && cp -r skills/plugins/expo/skills/expo-module ~/.claude/skills/

يعمل مع

claude appclaude codeclaude apicursorcodexwindsurfclinezed

خطوات التثبيت

Clone the repository and copy the `plugins/expo/skills/expo-module` folder into your Claude skills directory. Compatible with Claude Code, Cursor, Codex, and any Agent Skills-compatible agent.

عرض المصدر
الرخصة: MITبواسطة Expo

أسئلة شائعة

كيف أثبت Expo Module؟

شغل هذا الأمر في الطرفية:

git clone https://github.com/expo/skills && cp -r skills/plugins/expo/skills/expo-module ~/.claude/skills/
مع أي أدوات ذكاء اصطناعي تعمل Expo Module؟

تعمل مع claude_app، claude_code، claude_api، cursor، codex، windsurf، cline، zed.

من طور Expo Module؟

طورها Expo، وتصدر بترخيص MIT.

هل Expo Module مجانية؟

نعم، يمكنك استخدامها مجانا وفق ترخيص MIT.

أصول ذات صلة

مختارات أخرى في التطوير والبرمجة.

كل بدائل Expo Module ←
skillclaude_appclaude_codeclaude_api
npx skills add google/agents-cli
Google Agents Cli Adk Code
This skill should be used when the user wants to "write agent code", "build an agent with ADK", "add a tool", "create a callback", "define an agent",…358,165+
skillclaude_appclaude_codeclaude_api
npx skills add google/agents-cli
Google Agents Cli Workflow
This skill should be used when the user wants to "develop an agent", "build an agent using ADK", "run the agent locally", "debug agent code", "test an…357,749+
skillclaude_appclaude_codeclaude_api
npx skills add google/agents-cli
Google Agents Cli Eval
This skill should be used when the user wants to "run an evaluation", "evaluate my agent", "evaluate my ADK agent", "write an eval dataset", "analyze…357,721+
skillclaude_appclaude_codeclaude_api
npx skills add google/agents-cli
Google Agents Cli Deploy
This skill should be used when the user wants to "deploy an agent", "deploy my ADK agent", "set up CI/CD", "configure secrets", "troubleshoot a deploy…357,661+
skillclaude_appclaude_codeclaude_api
npx skills add google/agents-cli
Google Agents Cli Publish
This skill should be used when the user wants to "publish an agent", "publish my ADK agent", "register an agent with Gemini Enterprise", "publish to G…357,490+
skillclaude_appclaude_codeclaude_api
npx skills add prisma/skills
Prisma Cli
Prisma ORM CLI commands reference covering init, generate, migrate, db, dev, complete, studio, validate, format, debug, and mcp. Use for ORM/database…309,452+

افحص قبل التثبيت

شغل أي مصدر عبر فحوصاتنا - الظهور في الذكاء الاصطناعي والأمان والأداء واكتشاف التقنيات.

المزيد في التطوير والبرمجة