From b1ed4c59e4ef94e91ada9006e9b5c90f9f85039a Mon Sep 17 00:00:00 2001 From: jzh <1587315093@qq.com> Date: Tue, 18 Jul 2023 16:40:30 +0800 Subject: [PATCH] chore: side add type specification --- src/components/swipe-action/swipe-action.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/swipe-action/swipe-action.tsx b/src/components/swipe-action/swipe-action.tsx index 75d39e2250..dd912649e6 100644 --- a/src/components/swipe-action/swipe-action.tsx +++ b/src/components/swipe-action/swipe-action.tsx @@ -19,9 +19,11 @@ import { const classPrefix = `adm-swipe-action` +type SideType = 'left' | 'right' + export type SwipeActionRef = { close: () => void - show: (side?: 'left' | 'right') => void + show: (side?: SideType) => void } type ActionColor = @@ -47,7 +49,7 @@ export type SwipeActionProps = { closeOnAction?: boolean children: ReactNode stopPropagation?: PropagationEvent[] - onActionsReveal?: (side: 'left' | 'right') => void + onActionsReveal?: (side: SideType) => void } & NativeProps<'--background'> const defaultProps = { @@ -157,7 +159,7 @@ export const SwipeAction = forwardRef( } useImperativeHandle(ref, () => ({ - show: (side: 'left' | 'right' = 'right') => { + show: (side: SideType = 'right') => { if (side === 'right') { api.start({ x: -getRightWidth(),