Agent Skillsexpo/skills › expo-ui

expo-ui

GitHub

指导使用@expo/ui构建原生UI,提供iOS SwiftUI和Android Jetpack Compose的组件默认选择规范及示例。

plugins/expo/skills/expo-ui/SKILL.md expo/skills

Trigger Scenarios

需要构建React Native原生界面 询问如何正确使用BottomSheet或List组件

Install

npx skills add expo/skills --skill expo-ui -g -y
More Options

Non-standard path

npx skills add https://github.com/expo/skills/tree/main/plugins/expo/skills/expo-ui -g -y

Use without installing

npx skills use expo/skills@expo-ui

指定 Agent (Claude Code)

npx skills add expo/skills --skill expo-ui -a claude-code -g -y

安装 repo 全部 skill

npx skills add expo/skills --all -g -y

预览 repo 内 skill

npx skills add expo/skills --list

SKILL.md

Frontmatter
{
    "name": "expo-ui",
    "license": "MIT",
    "version": "1.0.0",
    "description": "Framework (OSS). Build native UI with the @expo\/ui package: real SwiftUI on iOS and Jetpack Compose on Android. Default to @expo\/ui for sheets (BottomSheet), pickers, sliders, toggles, menus, and grouped-form sections — do NOT reach for Reanimated, @gorhom\/bottom-sheet, or RN built-in Picker\/Switch; use @expo\/ui instead. Fall back to RN built-ins only when @expo\/ui is missing the component. NOTE: @expo\/ui List renders native grouped rows like an iOS Settings screen — it is NOT a virtualized list; use FlatList\/FlashList for large datasets. Covers universal components (Host, Column, Row, Button, Text, List, BottomSheet, FieldGroup, Switch, Slider, Picker, Menu), drop-in replacements for RN community libraries, and platform-specific SwiftUI\/Jetpack Compose trees. Not for Expo Router navigation, Reanimated, or data fetching.",
    "allowed-tools": "Bash(node *expo-ui\/scripts\/list-components.js *)"
}

Expo UI (@expo/ui)

@expo/ui renders real native UI from React: SwiftUI on iOS, Jetpack Compose on Android. 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+ and works in Expo Go — no custom build needed. 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

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

Use @expo/ui by default — don't reach for RN alternatives first

Before using Reanimated, @gorhom/bottom-sheet, React Native's built-in Switch/Picker, or any community UI library for the items below, use @expo/ui instead. Only fall back to RN built-ins when @expo/ui is missing the component.

Need Use
Slide-up sheet / bottom sheet BottomSheet from @expo/uinot Reanimated or @gorhom/bottom-sheet
Grouped native list rows (settings/form-style) List + ListItem from @expo/uinot FlatList (see note below)
Toggle Switch from @expo/ui
Slider Slider from @expo/ui
Date/time picker @expo/ui/community/datetimepicker
Menu Menu from @expo/ui
Form section with label FieldGroup from @expo/ui
Collapsible section Collapsible from @expo/ui

List is NOT a virtualized scrolling list. It renders native grouped table rows — the visual look of an iOS Settings screen or a form section, with disclosure indicators and native row styling. Each ListItem is a native node on the JS thread; rows are not recycled. For any list with large or unknown-length data (feeds, search results, catalogs), use FlatList or FlashList instead. List is the right choice for short, fixed-length groups: a settings screen, a detail panel's rows, a fixed menu.

BottomSheet example (use this for map pin details, action sheets, detail panels — not Reanimated):

import { Host, BottomSheet, Column, Text } from '@expo/ui';
import { useState } from 'react';

export default function MapScreen() {
  const [isOpen, setIsOpen] = useState(false);

  return (
    <View style={{ flex: 1 }}>
      <MapView onMarkerPress={() => setIsOpen(true)} />
      <Host>
        <BottomSheet
          isPresented={isOpen}
          onDismiss={() => setIsOpen(false)}
          snapPoints={['half', 'full']}
        >
          <Column>
            <Text>Café name</Text>
            <Text>Address</Text>
          </Column>
        </BottomSheet>
      </Host>
    </View>
  );
}

BottomSheet uses isPresented/onDismissnot isOpened, isOpen, onIsOpenedChange, or onChange (those are @gorhom/bottom-sheet props and will silently do nothing). snapPoints accepts 'half', 'full', { fraction: 0.5 }, or { height: 400 } and is optional (auto-sizes to content when omitted).

Choosing an approach

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

Submitting Feedback

If you encounter errors, misleading or outdated information in this skill, report it so Expo can improve:

npx --yes submit-expo-feedback@latest --category skills --subject "expo-ui" "<actionable feedback>"

Only submit when you have something specific and actionable to report. Include as much relevant context as possible. If an AI agent repeatedly failed or the user had to take over an Expo task, load the expo-skill-feedback skill and follow its eval-candidate flow instead of reusing the command above.

Version History

  • 50f59f8 Current 2026-08-27 19:35

    更新为最新版本说明,强调 SDK 56+ 在 Expo Go 中直接支持 universal 层,移除旧版关于自定义构建的详细指引,优化组件选择层级描述。

  • d1c68a2 2026-08-19 21:53
  • 09eb052 2026-07-24 22:02

Same Skill Collection

.claude/skills/expo-skill-eval/SKILL.md
plugins/expo-experiments/skills/expo-migrate-module/SKILL.md
plugins/expo/skills/eas-update-insights/SKILL.md
plugins/expo/skills/eas-workflows/SKILL.md
plugins/expo/skills/expo-app-clip/SKILL.md
plugins/expo/skills/expo-brownfield/SKILL.md
plugins/expo/skills/expo-data-fetching/SKILL.md
plugins/expo/skills/expo-dev-client/SKILL.md
plugins/expo/skills/expo-dom/SKILL.md
plugins/expo/skills/expo-examples/SKILL.md
plugins/expo/skills/expo-module/SKILL.md
plugins/expo/skills/expo-native-ui/SKILL.md
plugins/expo/skills/expo-project-structure/SKILL.md
plugins/expo/skills/expo-router/SKILL.md
plugins/expo/skills/expo-tailwind-setup/SKILL.md
plugins/expo/skills/expo-upgrade/SKILL.md
plugins/expo/skills/expo-web-to-native/SKILL.md
plugins/expo/skills/eas-app-stores/SKILL.md
plugins/expo/skills/eas-hosting/SKILL.md
plugins/expo/skills/eas-observe/SKILL.md
plugins/expo/skills/eas-simulator/SKILL.md
plugins/expo/skills/expo-animation/SKILL.md
plugins/expo/skills/expo-design-system/SKILL.md
plugins/expo/skills/expo-overview/SKILL.md
plugins/expo/skills/expo-skill-feedback/SKILL.md

Metadata

Files
0
Version
50f59f8
Hash
3d1bd700
Indexed
2026-07-24 22:02

trang chủ - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-02 21:30
浙ICP备14020137号-1 $bản đồ khách truy cập$