expo-module
ما الذي تفعله
يساعدك هذا الدليل على إنشاء وكتابة «الوحدات الأصلية» (native modules) و«العروض الأصلية» (native views) لتطبيقات Expo. ويستخدم واجهة خاصة تُسمى Expo Modules API لربط Swift (iOS) وKotlin (Android) وكود TypeScript.
متى تستخدمها
- ✓عندما تحتاج إلى إضافة وظيفة جديدة لتطبيق Expo غير موجودة بشكل أصلي.
- ✓عندما تدمج حزمة تطوير منصة (مثل الكاميرا أو المستشعرات) لا تدعمها React Native مباشرة.
- ✓لإنشاء عناصر مرئية مخصصة تعمل على iOS وAndroid معًا.
رابط المهارة
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/expo-module/SKILL.mdانسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.
طريقة الاستخدام
أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.
رسالة جاهزة للصق
لـ Claude Code أو Codex أو Cursor: شغّله داخل مجلد مشروعك وستُثبَّت المهارة.
نزّل ملف SKILL.md وضعه في مجلد مهارات وكيلك.
مثال على ما تطلبه من الذكاء الاصطناعي
“كيف أنشئ وحدة أصلية جديدة لتطبيق Expo باستخدام Expo Modules API؟”
5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.
كيف تعمل
تستخدم أمرًا اسمه `create-expo-module` لتوليد البنية الأساسية للوحدة. ثم تعدّل ملفات Swift (لـiOS) وKotlin (لـAndroid) المُولَّدة لتحديد وظائفك، مع استخدام TypeScript للجزء الخاص بـJavaScript.
المحتوى التقني (ملف SKILL.md الأصلي)
النص الأصلي من المؤلف، مباشرة من 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() {
…
الأسئلة الشائعة
ما هي «الوحدات الأصلية» و«العروض الأصلية»؟
الوحدات الأصلية هي أجزاء من الكود تعمل مباشرة على نظام الهاتف (iOS أو Android) ويمكنك استدعاؤها من كود JavaScript. أما العروض الأصلية فهي عناصر مرئية (مثل الأزرار والقوائم) تُنشأ أيضًا بكود أصلي.
هل أحتاج إلى معرفة Swift وKotlin لاستخدامها؟
نعم، ستحتاج إلى كتابة كود بلغة Swift لنظام iOS وKotlin لنظام Android لتنفيذ منطق الوحدة. ويشرح الدليل كيفية ذلك باستخدام Expo Modules API.
ما هي «config plugins»؟
هي ميزة تتيح لك تعديل ملفات الإعداد الأصلية للمشروع تلقائيًا (مثل `AndroidManifest.xml` على Android أو `Info.plist` على iOS) عند بناء التطبيق.
التفاصيل
الوصف الأصلي من المؤلف
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.
الشعبية
- نجوم GitHub
- 48k
- الترتيب
- #4575
- الترخيص
- MIT
- آخر تحديث
- 15/10/2026
التعليقات
- …
المزيد من المهارات من هذا المستودع
00-andruia-consultant
48kيساعد وكيلك على بدء مشاريع الذكاء الاصطناعي أو تحسينها. يحلل الكود ويقترح الأدوات ويُعد خطط عمل بالإسبانية.
007
48kيتيح لوكيلك إجراء تدقيقات أمنية ونمذجة التهديدات. مفيد لحماية المشاريع من الهجمات والثغرات الأمنية.
10-andruia-skill-smith
48kيساعد وكيلك على إنشاء أدوات الذكاء الاصطناعي أو تحسينها. يحدد طريقة عملها، ويكتب توثيقها، ويتحقق من بنيتها.
20-andruia-niche-intelligence
48kيتيح لوكيلك إعداد ملخص عن صناعة محددة. مفيد لفهم السياق والقواعد وأنماط الاستخدام والمخاطر لمشروع ما، باستخدام مصادر موثوقة.
مهارات مشابهة
android-clean-architecture
280kينظّم وكيلك مشاريع أندرويد بكفاءة، ويبني الشيفرة بطريقة تجعل الصيانة وإضافة الميزات الجديدة أسهل.
compose-multiplatform-patterns
280kيساعد وكيلك على استعمال أنماط Compose Multiplatform وJetpack Compose في مشاريع KMP، وتشمل الحالة والتنقل والتصميم والأداء.
dart-flutter-patterns
280kيساعد وكيلك على كتابة شيفرة تطبيقات Dart وFlutter، باستعمال أنماط حديثة لبناء تطبيقات متينة وسهلة الإدارة.