Types for the parameters used in the react easy swipe package implementation codes. Typescript type for the event parameter used in the react easy swipe library usage codes.
Type for the event parameter is:
React.TouchEvent | React.MouseEvent
function onSwipeStart(event : React.TouchEvent | React.MouseEvent) { console.log('Start swiping...', event) }
Type for the position parameter is:
export interface SwipePosition { x: number; y: number; }
eg:
export interface SwipePosition { x: number; y: number; } function onSwipeMove(position: SwipePosition) { //actions }
React Swipe Easy Types
react-easy-swipe.d.ts
/* eslint-disable */ import * as React from 'react'; export interface SwipePosition { x: number; y: number; } export type SwipeEvent = TouchEvent | MouseEvent; interface SwipeProps { tagName?: string; className?: string; style?: React.CSSProperties; children?: JSX.Element; allowMouseEvents?: boolean; onSwipeUp?: (trigger: 1) => void; onSwipeDown?: (trigger: 1) => void; onSwipeLeft?: (trigger: 1) => void; onSwipeRight?: (trigger: 1) => void; onSwipeStart?: (e: SwipeEvent) => void; onSwipeMove?: (position: SwipePosition, e: SwipeEvent) => void; onSwipeEnd?: (e: SwipeEvent) => void; } export default class Swipe extends React.Component<SwipeProps> {}