Skip to content
项目

关于

A collection of examples using expo-ui

学习与教育

这些数字如何统计

实测星标增长

24小时
0
7天
0
15天
0
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

Expo UI Examples

A collection of small, self-contained @expo/ui demos (Expo SDK 58 beta). The whole app is built with Expo UI.

Examples

Example What it shows
Animated Symbols Tap SF Symbols to play symbolEffect animations
Numeric Transitions Counter with numericText content transitions and glass buttons
Swift Charts Every native Chart type animating on one shared data set
Liquid Glass GlassEffectContainer morphing orbs, tinted glass, clear/regular variants (iOS 26+)
Tab Bar Mini Player A mini player docked above the liquid-glass tab bar with NativeTabs.BottomAccessory, expanding into a full-screen player (iOS 26+)
Rich Text Editor Two ConcentricRectangle panels (iOS 26+; plain rounded panels before that), with a segmented format bar that rides the keyboard's safe area
Apple Zoom A photo grid whose thumbnails zoom into a full-screen photo with Link.AppleZoom (iOS 18+)
Color Picker The native SwiftUI ColorPicker repainting the whole page with the selected color
Hinge expo-hinge angle and status, native grouped session stats, and adaptive ArrangementView panels (iOS 27.1+)

Android

Example What it shows
Material You Seed a Material 3 palette from a color or the device wallpaper with useMaterialColors
Expressive Loaders Morphing LoadingIndicator and wavy progress indicators driven by a fake install
Material 3 Carousel Hero, multi-browse, and uncontained native Compose carousels browsing one photo set
Hinge Live expo-hinge angle and system status with grouped session stats and reset

Universal

Example What it shows
Universal Settings One tree of universal components rendering as a SwiftUI Form and a Material 3 grouped list, with every control wired back into Host
Bottom Sheet A universal BottomSheet that fits its content and grows as additional rows are revealed

Each example lives in its own folder under src/examples/ with all of its components, so a demo can be dropped into any Expo SDK 58 project as-is. New examples register themselves in src/examples/registry.ts, where platform decides which list they appear in — 'universal' puts an example in both.

An example that demos a navigation transition needs its own routes, since the transition is played by the router. Those examples own thin files under src/app/ that render screens from the example folder — a single detail route like src/app/apple-zoom/[id].tsx, or a whole NativeTabs layout like src/app/mini-player/.

The iOS examples use @expo/ui/swift-ui (SF Symbols, Swift Charts, glass buttons) and need iOS 17+. The Android examples use @expo/ui/jetpack-compose; wallpaper-derived colors need Android 12+, and everything else falls back to the Material 3 baseline. The universal examples import from the @expo/ui root instead, so the same files run on both. Universal Settings has no platform code at all; Bottom Sheet splits only its Continue button (glass exists only in SwiftUI).

Android icons come from @expo/material-symbols, one import per icon, and iOS icons are SF Symbols by name.

Get started

  1. Install dependencies

    bun install
    
  2. Start the app

    bun run ios
    # or
    bun run android
    

Both scripts run a native build (expo run:*) — @expo/ui renders real SwiftUI and Jetpack Compose views, so Expo Go isn't enough.

The iOS Hinge example needs Xcode 27.1+ and iOS 27.1+. package.json builds the ExpoUI pod from source so the new ArrangementView is compiled against the local SDK. The SDK 58.0.14 precompiled framework does not include the native arrangement container. The Android Hinge screen shares its session logic and needs Android 11+ and a public hinge-angle sensor; isAvailable() alone does not confirm sensor support.

bun run lint runs ESLint and bun run format applies the repo's Prettier config.

Test Hinge on an Android emulator

Create a foldable virtual device in Android Studio, such as Pixel Fold, with Android 11+ and a virtual hinge sensor. Run bun run android and open Hinge from the Android examples list.

Check that hinge-angle0 is enabled, then change its angle. Replace emulator-5554 with your emulator's serial from adb devices.

adb -s emulator-5554 emu sensor status
adb -s emulator-5554 emu sensor set hinge-angle0 90
adb -s emulator-5554 emu sensor set hinge-angle0 120.5
adb -s emulator-5554 emu sensor set hinge-angle0 0
adb -s emulator-5554 emu sensor set hinge-angle0 180

The angle updates live. The system status is Partially open at 90° and Fully open at 180°. At 0°, the Pixel Fold emulator switches to its cover display and reports Unknown. The session keeps its lowest and highest readings across folds. Reset session sets both to the current angle and clears the event count.

If the demo shows API available: Yes but No reading, check that you chose a foldable profile with hinge-angle0 enabled. An emulator test verifies the Android integration; test a physical Fold 8 separately to confirm that its firmware exposes the sensor.

Demoing Material You

Driving the wallpaper picker by hand is fiddly on an emulator. Android 12+ keeps the Material You source color in Settings.Secure, so you can set it directly:

adb shell "settings put secure theme_customization_overlay_packages \
  '{\"android.theme.customization.system_palette\":\"FF1B6E00\",\
    \"android.theme.customization.color_source\":\"preset\",\
    \"android.theme.customization.theme_style\":\"TONAL_SPOT\"}'"

# back to the real wallpaper palette
adb shell "settings delete secure theme_customization_overlay_packages"

Compose components retheme immediately. Colors read in JS through useMaterialColors do not — the hook reads the palette per render but never subscribes to system changes — so the Android examples re-render when the app returns to the foreground to keep both in sync.

Structure

src/
  app/
    _layout.tsx         Stack navigator
    index.tsx           SwiftUI list of the iOS and universal examples
    index.android.tsx   Jetpack Compose list of the Android and universal examples
    [slug].tsx          Renders the example matching the route
    apple-zoom/         Route files owned by the Apple Zoom example
    mini-player/        Route files owned by the Tab Bar Mini Player example
  examples/
    registry.ts         One entry per example (slug, title, icons, screen, platform)
    <example>/
      index.tsx         The example's screen
      *.tsx             The example's components

探索相关项目

加载中…