跳到正文
Skillpedia
移动应用48k · #4580

expo-ui

它能做什么

这个工具可以用代码帮你创建移动应用的可视化界面。它允许你构建按钮、文本等元素,这些元素既能在 iPhone 上运行(使用 SwiftUI 技术),也能在 Android 手机上运行(使用 Jetpack Compose),而且全部来自同一套用 React 编写的代码。

适用场景

  • ✓当你希望应用在 iOS 和 Android 上都有原生的外观和手感时。
  • ✓当你从其他 UI 库迁移到 Expo UI 时。
  • ✓当你需要在两个平台上都能用的 UI 组件,又不想为每个平台分别写代码时。

技能链接

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/expo-ui/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/expo-ui/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“使用 Expo UI 创建一个简单的按钮,上面的文字是“点击这里”。”

每周 5 个新技能,1 分钟读完。

工作原理

你在 React 中编写代码,从 `@expo/ui` 包中导入组件。大多数情况下,你会使用可在两个平台上通用的组件。如果需要非常特定的功能,也可以直接使用为 iOS(SwiftUI)或 Android(Jetpack Compose)专门制作的组件。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Expo UI (@expo/ui)

When to Use

Use this skill when you need build native UI with the @expo/ui package: real SwiftUI on iOS and Jetpack Compose on Android rendered from React in an Expo or React Native app. Covers universal cross-platform components (Host, Column, Row, Button, Text, List, and more imported from @expo/ui), drop-in replacements...

@expo/ui renders real native UI from React: SwiftUI on iOS, Jetpack Compose on Android. Start with its universal components (one tree for iOS, Android, and web) and drop to platform-specific SwiftUI/Jetpack Compose only when the universal layer falls short. It also ships drop-in replacements for migrating off RN community UI libraries.

These instructions track the latest Expo SDK. The universal layer requires SDK 56+. Drop-in replacements and the platform-specific layers also exist on SDK 55. For component details on a specific SDK, refer to the Expo UI docs for that version.

Installation

npx expo install @expo/ui

On SDK 56, @expo/ui works in Expo Go, so npx expo start runs it directly — no custom build required. On older SDKs, build a dev client first (npx expo run:ios / npx expo run:android).

Every @expo/ui tree — universal or platform-specific — must be wrapped in Host.

Choosing an approach (read this first)

Work down this list and stop at the first layer that meets the need:

  1. Universal components — start here. Import from the @expo/ui root. One component tree runs unmodified on iOS, Android, and web from a single source (Compose on Android, SwiftUI on iOS, react-native-web/react-dom on web). No platform file splits. → ./references/universal.md

  2. Platform-specific (SwiftUI / Jetpack Compose). Import from @expo/ui/swift-ui or @expo/ui/jetpack-compose. Use only when the universal layer is missing a component or modifier you need, or when you need platform-specific behavior or optimization. Downside: you write two trees and split them into .ios.tsx / .android.tsx files (or branch on Platform.OS) — more code to maintain.

    @expo/ui/swift-ui is iOS-only. @expo/ui/jetpack-compose is Android-only. Importing either in a file that runs on the other platform will crash at runtime with "Unable to get view config" errors. Isolate platform-specific trees in .ios.tsx / .android.tsx files placed in components/ (never inside app/ — Expo Router does not support platform extensions for route files), or guard with Platform.OS in a regular route file. Host must always be imported from @expo/ui (the universal package root), not from the platform-specific sub-packages. → ./references/swift-ui.md and ./references/jetpack-compose.md

Already using an RN community UI library? @expo/ui also ships drop-in replacements — API-compatible swaps for popular libraries (@gorhom/bottom-sheet, @react-native-community/datetimepicker, and more), imported from @expo/ui/community/<name>. This is a migration side-path for replacing an existing dependency, not a step in the universal-vs-platform decision above. → ./references/drop-in-replacements.md

References

Consult these resources as needed:

references/
  universal.md             Universal @expo/ui components and when to use them (SDK 56+)
  drop-in-replacements.md  API-compatible replacements for RN community UI libraries
  swift-ui.md              Platform-specific iOS UI: @expo/ui/swift-ui components, modifiers, RNHostView, useNativeState
  jetpack-compose.md       Platform-specific Android UI: @expo/ui/jetpack-compose components, modifiers, LazyColumn caveat, icons, useNativeState

Limitations

  • Use this skill only when the task clearly matches its upstream product or API scope.
  • Verify commands, API behavior, pricing, quotas, credentials, and deployment effects against current official documentation before making changes.
  • Do not treat generated examples as a substitute for environment-specific tests, security review, or user approval for destructive or costly actions.
常见问题

什么是通用组件?

通用组件是指在 iOS、Android 甚至网页上都能良好运行的 UI 组件,让你只需编写一套代码就能服务所有平台。

什么时候应该使用针对 iOS 或 Android 的专用组件?

只有在通用组件无法满足需求,或者你需要平台专属功能来进行优化或实现特定行为时,才使用它们。

使用 Expo UI 需要做什么特别的设置吗?

需要。你得在项目中安装 `@expo/ui` 包。从 Expo SDK 56 开始,它可以直接在 Expo Go 中运行;在旧版本上,你可能需要构建一个开发客户端。

详情

作者的原始描述

Build native UI with the @expo/ui package: real SwiftUI on iOS and Jetpack Compose on Android rendered from React in an Expo or React Native app.

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#4580
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能