This is documentation for the next SDK version. For up-to-date documentation, see the latest version (SDK 56).
SwipeActions
一个 SwiftUI SwipeActions 组件,用于为行内容添加前导和尾随滑动操作。
iOS
Included in Expo Go
For the complete documentation index, see llms.txt. Use this file to discover all available pages.
Expo UI SwipeActions 与官方 SwiftUI swipeActions 修饰符一致,并允许你为行内容添加左侧或右侧操作。
安装
Terminal
- npx expo install @expo/uiIf you are installing this in an existing React Native app, make sure to install expo in your project.
用法
SwipeActionsExample.tsx
import { Button, Host, List, Section, SwipeActions, Text } from '@expo/ui/swift-ui'; export default function SwipeActionsExample() { return ( <Host style={{ flex: 1 }}> <List> <Section> <SwipeActions> <Text>来自 Expo 的消息</Text> <SwipeActions.Actions edge="leading" allowsFullSwipe={false}> <Button label="置顶" systemImage="pin" onPress={() => {}} /> </SwipeActions.Actions> <SwipeActions.Actions edge="trailing"> <Button label="删除" systemImage="trash" role="destructive" onPress={() => {}} /> </SwipeActions.Actions> </SwipeActions> </Section> </List> </Host> ); }
API
import { SwipeActions } from '@expo/ui/swift-ui';
Components
Type: React.Element<SwipeActionsProps>
Applies native SwiftUI swipe actions to its non-slot children.
Type: React.Element<SwipeActionsGroupProps>
The buttons revealed when the user swipes the regular content from an edge.