Reference version

This is documentation for the next SDK version. For up-to-date documentation, see the latest version (SDK 55).

一个用于分组视图且不影响布局的 SwiftUI Group 组件。

iOS
tvOS

For the complete documentation index, see llms.txt. Use this Use this file to discover all available pages.

Expo UI Group 与官方 SwiftUI Group API 一致,它会将视图分组在一起,而不会引入额外的布局结构。

安装

Terminal
npx 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 { Host, Group, Text } from '@expo/ui/swift-ui'; import { foregroundStyle } from '@expo/ui/swift-ui/modifiers'; export default function BasicGroupExample() { return ( <Host matchContents> <Group modifiers={[foregroundStyle({ color: 'blue' })]}> <Text>第一项</Text> <Text>第二项</Text> <Text>第三项</Text> </Group> </Host> ); }

API

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

Component

Group

iOS
tvOS

Type: React.Element<GroupProps>

GroupProps

children

iOS
tvOS
Type: ReactNode