expo-module
Fungsinya
Panduan ini membantu Anda membuat dan menulis 'native modules' dan 'native views' untuk aplikasi Expo. Panduan ini menggunakan API khusus bernama Expo Modules API untuk menghubungkan kode Swift (iOS), Kotlin (Android), dan TypeScript.
Kapan dipakai
- ✓Saat Anda perlu menambahkan fungsi baru ke aplikasi Expo yang belum tersedia secara native.
- ✓Saat mengintegrasikan SDK platform (seperti kamera atau sensor) yang belum didukung langsung oleh React Native.
- ✓Untuk membuat komponen visual khusus yang berjalan di iOS dan Android.
Link skill
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/expo-module/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
“Bagaimana cara membuat native module baru untuk aplikasi Expo saya menggunakan Expo Modules API?”
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Anda menggunakan perintah `create-expo-module` untuk membuat struktur dasar modul. Kemudian, Anda menyunting file Swift (untuk iOS) dan Kotlin (untuk Android) yang dihasilkan untuk mendefinisikan fungsinya, dan menggunakan TypeScript untuk bagian JavaScript-nya.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.
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 modeexpo.autolinking.nativeModulesDiradd-platform-supportbehavior and quirks
Recommended Workflow
- Choose the scaffold type first:
- Local module for one app
- Standalone module for reuse, monorepos, or publishing
- Determine native
expo-modulefeatures 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
- Scaffold deliberately:
- pass an explicit slug or path
- choose
--platformintentionally instead of relying on defaults - use
--featuresto choose code samples which you will modify in the next step to match the real implementation.
- Replace generated example code with the real implementation.
- If you add a new platform later, prefer
add-platform-supportover manual file copying.
Practical Scaffolding Rules
- Feature examples are opt-in. A newly scaffolded module may be minimal if no features were selected.
ViewEventimpliesView.- Local modules do not generate an
index.tsbarrel by default. Use--barrelonly if you want one. - In non-interactive local scaffolding, pass the positional slug or path explicitly.
--namechanges the native class name, not the folder name. - Local modules live in
expo.autolinking.nativeModulesDirwhen configured, otherwise inmodules/. - 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() {
…
Pertanyaan umum
Apa itu 'native modules' dan 'native views'?
Native modules adalah bagian kode yang berjalan langsung di sistem ponsel (iOS atau Android) dan dapat dipanggil dari kode JavaScript Anda. Native views adalah komponen visual (seperti tombol atau daftar) yang juga dibuat dengan kode native.
Apakah saya harus memahami Swift dan Kotlin untuk menggunakan ini?
Ya, Anda perlu menulis kode dalam Swift untuk iOS dan Kotlin untuk Android guna menerapkan logika modul native Anda. Panduan ini menjelaskan caranya menggunakan Expo Modules API.
Apa itu 'config plugins'?
Config plugins adalah fitur yang memungkinkan Anda memodifikasi file konfigurasi native proyek secara otomatis (seperti `AndroidManifest.xml` di Android atau `Info.plist` di iOS) saat aplikasi dibangun.
Detail
Deskripsi asli dari pembuat
Guide for creating and writing Expo native modules and views using the Expo Modules API (Swift, Kotlin, TypeScript). Covers module definition DSL, native views, shared objects, config plugins, lifecycle hooks, autolinking, and type system.
Popularitas
- Bintang GitHub
- 48k
- Peringkat
- #4575
- Lisensi
- MIT
- Diperbarui
- 15/10/2026
Komentar
- …
Skill lain dari repositori ini
00-andruia-consultant
48kMembantu agent Anda memulai atau meningkatkan proyek AI. Agent menganalisis kode, menyarankan tools, dan membuat rencana aksi dalam bahasa Spanyol.
007
48kMemungkinkan agent Anda melakukan audit keamanan dan threat modeling. Berguna untuk melindungi proyek dari serangan dan celah keamanan.
10-andruia-skill-smith
48kMembantu agent Anda membuat atau meningkatkan tools AI. Agent mendefinisikan cara kerja tools, menulis dokumentasi, dan memvalidasi strukturnya.
20-andruia-niche-intelligence
48kMemungkinkan agent Anda membuat ringkasan industri tertentu. Berguna untuk memahami konteks, aturan, pola penggunaan, dan risiko proyek dengan sumber terpercaya.
Skill serupa
android-clean-architecture
280kMembuat agent Anda mengatur proyek Android dengan efisien. Struktur kodenya dibuat agar lebih mudah dirawat dan pengembangan fitur baru.
compose-multiplatform-patterns
280kMembantu agent Anda menggunakan pola Compose Multiplatform dan Jetpack Compose di proyek KMP, mencakup state, navigasi, theming, dan performa.
dart-flutter-patterns
280kMembuat agent Anda menulis kode untuk aplikasi Dart dan Flutter. Menggunakan pola modern agar aplikasi kokoh dan mudah dikelola.