This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.
弹出框
用于在浮动叠层中显示内容的 SwiftUI 弹出框组件。
Expo UI Popover 与官方 SwiftUI Popover API 匹配,并提供了一种将内容显示在浮动覆盖层中的方式,该覆盖层锚定到触发元素。


安装
If you are installing this in an existing React Native app, make sure to install expo in your project.
用法
基本弹出框
设置附着锚点
attachmentAnchor 属性控制弹出框附着到触发元素的位置。可用选项包括:center、leading、trailing、top 和 bottom。
设置箭头边缘
arrowEdge 属性控制弹出框的哪一侧显示箭头。可用选项包括:none、leading、trailing、top 和 bottom。
使用 React Native 内容
你可以使用 RNHostView 在弹出框内容中嵌入 React Native 组件。
API
import { Popover } from '@expo/ui/swift-ui';
Component
Type: React.Element<PopoverViewProps>
Props
string • Default: 'none'The edge of the attachmentAnchor that defines the location of the popover's arrow. The default is none, which results in the system allowing any arrow edge.
Acceptable values are: 'top' | 'none' | 'bottom' | 'leading' | 'trailing'
stringThe positioning anchor that defines the attachment point of the popover.
Acceptable values are: 'center' | 'top' | 'bottom' | 'leading' | 'trailing'
ReactNode(isPresented: boolean) => voidA callback that is called when the isPresented state changes.