This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.
DisclosureGroup
用于显示可展开内容的 SwiftUI DisclosureGroup 组件。
iOS
Included in Expo Go
Expo UI DisclosureGroup 与官方 SwiftUI DisclosureGroup API 保持一致,并显示一个展开指示器,用于显示或隐藏内容。


安装
Terminal
If you are installing this in an existing React Native app, make sure to install expo in your project.
用法
基本折叠组
DisclosureGroup 最常用于 Form 中,这样它就会采用带有展开指示箭头的标准 iOS 列表样式。
BasicDisclosureGroupExample.tsx
初始展开
将 isExpanded 初始设置为 true,即可默认显示内容。
InitiallyExpandedExample.tsx
自定义标签
当标签需要自定义 SwiftUI 内容或修饰符,而不是 label 字符串属性时,请使用 DisclosureGroup.Label。
CustomLabelDisclosureGroupExample.tsx
API
import { DisclosureGroup } from '@expo/ui/swift-ui';
Component
Type: React.Element<DisclosureGroupProps>
Type:
ReactNodeOptional • Type:
stringText label for the disclosure group. Use DisclosureGroup.Label for custom label content.
Optional • Type:
(isExpanded: boolean) => voidA callback that is called when the expansion state changes.