Reference version

This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.

Group

一个 SwiftUI Group 组件,用于对视图进行分组而不影响布局。

iOS
tvOS
Included in Expo Go
Recommended version:
~58.0.1

Expo UI Group 与官方 SwiftUI Group API 相对应,可将视图组合在一起,而不会引入额外的布局结构。

安装

Terminal
- npx expo install @expo/ui
- yarn expo install @expo/ui
- pnpm expo install @expo/ui
- bun expo install @expo/ui

If you are installing this in an existing React Native app, make sure to install expo in your project.

用法

基本分组

分组适用于一次为多个视图应用修饰符,或在不影响布局的情况下组织视图。

BasicGroupExample.tsx
import { Group, Host, Text, VStack } from '@expo/ui/swift-ui'; import { foregroundStyle } from '@expo/ui/swift-ui/modifiers'; export default function BasicGroupExample() { return ( <Host matchContents style={{ alignSelf: 'center' }}> <VStack spacing={8}> <Group modifiers={[foregroundStyle('blue')]}> <Text>First item</Text> <Text>Second item</Text> <Text>Third item</Text> </Group> </VStack> </Host> ); }

API

import { Group } from '@expo/ui/swift-ui';

Component

Group

iOS
tvOS

Type: React.Element<GroupProps>

GroupProps

children

iOS
tvOS
Type: ReactNode