This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.
SwipeActions
一个 SwiftUI SwipeActions 组件,用于为行内容添加左侧和右侧滑动操作。
iOS
Included in Expo Go
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.