UNPKG

@nutui/nutui-react-taro

Version:

京东风格的轻量级移动端 React 组件库,支持一套代码生成 H5 和小程序

29 lines (28 loc) 1.28 kB
import { default as React, TouchEvent, MouseEvent } from 'react'; import { BasicComponent } from '../../utils/typings'; export type SwipeSide = 'left' | 'right'; export interface SwipeInstance { open: (side: SwipeSide) => void; close: () => void; } export interface SwipeProps extends BasicComponent { name?: string | number; leftAction?: React.ReactNode; rightAction?: React.ReactNode; /** 关闭前的回调函数,返回 false 可阻止关闭,支持返回 Promise */ beforeClose?: (position: string) => void; disabled?: boolean; onOpen?: ({ name, position, }: { name: string | number; position: SwipeSide; }) => void; onClose?: ({ name, position, }: { name: string | number; position: SwipeSide; }) => void; onActionClick?: (event: MouseEvent<HTMLDivElement>, position: SwipeSide) => void; onTouchStart?: (event: TouchEvent<HTMLDivElement>) => void; onTouchEnd?: (event: TouchEvent<HTMLDivElement>) => void; onTouchMove?: (event: TouchEvent<HTMLDivElement>) => void; } export declare const Swipe: React.ForwardRefExoticComponent<Partial<SwipeProps> & Omit<React.HTMLAttributes<HTMLDivElement>, "onTouchStart" | "onTouchMove" | "onTouchEnd"> & React.RefAttributes<SwipeInstance>>;