import { StyleProp, ViewStyle, TextStyle } from 'react-native'; /** * 滑动操作按钮配置 */ export interface SwipeActionButton { /** 按钮唯一标识 */ key: string; /** 按钮文字 */ text?: string; /** 按钮图标(ReactNode) */ icon?: React.ReactNode; /** 按钮背景颜色 */ backgroundColor?: string; /** 按钮文字颜色 */ color?: string; /** 按钮宽度 */ width?: number; /** 点击回调 */ onPress?: () => void; /** 自定义按钮样式 */ style?: StyleProp; /** 自定义文字样式 */ textStyle?: StyleProp; } /** * DbSwipeAction 组件属性 */ export interface DbSwipeActionProps { /** 子内容(卡片内容) */ children: React.ReactNode; /** 右侧操作按钮(左滑显示) */ rightActions?: SwipeActionButton[]; /** 左侧操作按钮(右滑显示) */ leftActions?: SwipeActionButton[]; /** 是否禁用滑动 */ disabled?: boolean; /** 滑动阈值(触发显示操作按钮的最小滑动距离),默认 20 */ threshold?: number; /** 滑动触发速度阈值,默认 0.3 */ velocityThreshold?: number; /** 单个操作按钮默认宽度,默认 80 */ actionWidth?: number; /** 是否自动关闭(点击操作按钮后),默认 true */ autoClose?: boolean; /** 打开状态改变回调 */ onOpenChange?: (open: boolean, direction: 'left' | 'right' | null) => void; /** 自定义容器样式 */ style?: StyleProp; /** 自定义内容容器样式 */ contentStyle?: StyleProp; /** 事件 */ onPress?: () => void; /** * 唯一标识,用于列表行互斥 * 如果不传,会自动生成 */ swipeId?: string; /** * 是否开启互斥模式(打开一个时自动关闭其他) * 默认 true */ exclusive?: boolean; } /** * DbSwipeAction 组件 Ref */ export interface DbSwipeActionRef { /** 关闭滑动面板 */ close: () => void; /** 打开左侧操作按钮 */ openLeft: () => void; /** 打开右侧操作按钮 */ openRight: () => void; }