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: 'none' | 'top' | '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.