SwiftUI
使用 @expo/ui 构建原生 iOS 界面的 SwiftUI 组件。
iOS
tvOS
For the complete documentation index, see llms.txt. Use this Use this file to discover all available pages.
@expo/ui/swift-ui 中的 SwiftUI 组件允许你通过 React Native 使用 SwiftUI 构建完全原生的 iOS 界面。
安装
Terminal
- npx expo install @expo/uiIf you are installing this in an existing React Native app, make sure to install expo in your project.
使用
使用 @expo/ui/swift-ui 中的组件需要将其包装在 Host 组件中。Host 是 SwiftUI 视图的容器。
import { Host, Button } from '@expo/ui/swift-ui'; export function SaveButton() { return ( <Host style={{ flex: 1 }}> <Button label="保存更改" /> </Host> ); }
有关更多信息,请参阅以下资源:
Expo UI 的 Swift UI 指南
了解 @expo/ui/swift-ui 的基础知识
通过 SwiftUI 扩展
创建与 Expo UI 集成的自定义 SwiftUI 组件和修饰器。

Expo UI iOS Liquid Glass 教程
了解如何使用新的 Expo UI 在你的 React Native 应用中构建真正的 SwiftUI 视图。