This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.
背景
用于在另一个视图后方分层显示内容的 SwiftUI Background 组件。
iOS
tvOS
Included in Expo Go
Expo UI Background 与官方 SwiftUI background 修饰符相匹配,会在视图后方绘制背景内容,并按照指定的对齐方式定位。基础视图会保持自身尺寸。
要用颜色、材质或渐变填充视图,请使用
@expo/ui/swift-ui/modifiers中的background修饰符。
安装
Terminal
If you are installing this in an existing React Native app, make sure to install expo in your project.
用法
基本背景
BackgroundExample.tsx
背景对齐方式
使用 alignment 属性相对于基础视图定位背景内容。由于背景不会影响基础视图的布局,因此较小的背景可以固定在基础视图的某个边缘上。
BackgroundAlignmentExample.tsx
API
import { Background } from '@expo/ui/swift-ui';
Component
Type: React.Element<BackgroundProps>