• Version 0.0.22
  • Published
  • 280 kB
  • 1 dependency
  • MIT license


npm i rc-gesture
yarn add rc-gesture
pnpm add rc-gesture


Support gesture for react component



class Gesture

class Gesture extends Component<IGesture, any> {}


    constructor(props: any);

      property allowGesture

      allowGesture: () => boolean;

        property checkIfMultiTouchEnd

        checkIfMultiTouchEnd: (status: any) => void;

          property checkIfMultiTouchMove

          checkIfMultiTouchMove: () => void;

            property checkIfMultiTouchStart

            checkIfMultiTouchStart: () => void;

              property checkIfSingleTouchMove

              checkIfSingleTouchMove: () => void;

                property cleanGestureState

                cleanGestureState: () => void;

                  property cleanPressTimer

                  cleanPressTimer: () => void;

                    property defaultProps

                    static defaultProps: {
                    enableRotate: boolean;
                    enablePinch: boolean;
                    direction: string;

                      property doSingleTouchEnd

                      doSingleTouchEnd: (status: any) => void;

                        property event

                        protected event: any;

                          property gesture

                          protected gesture: IGestureStatus;

                            property getGestureState

                            getGestureState: () => {
                            startTime: number;
                            startTouches: Finger[];
                            startMutliFingerStatus?: MultiFingerStatus[] | undefined;
                            time: number;
                            touches: Finger[];
                            preTouches: Finger[];
                            mutliFingerStatus?: MultiFingerStatus[] | undefined;
                            moveStatus?: SingeFingerMoveStatus | undefined;
                            press?: boolean | undefined;
                            pan?: boolean | undefined;
                            availablePan?: boolean | undefined;
                            swipe?: boolean | undefined;
                            direction?: number | undefined;
                            pinch?: boolean | undefined;
                            scale?: number | undefined;
                            rotate?: boolean | undefined;
                            rotation?: number | undefined;
                            srcEvent: any;

                              property getTouchAction

                              getTouchAction: () => 'auto' | 'pan-x pan-y' | 'pan-x' | 'pan-y';

                                property getTouches

                                getTouches: (e: any) => any;

                                  property initGestureStatus

                                  initGestureStatus: (e: any) => void;

                                    property initPressTimer

                                    initPressTimer: () => void;

                                      property setGestureState

                                      setGestureState: (params: any) => void;

                                        property state

                                        state: {};

                                          property triggerAllowEvent

                                          triggerAllowEvent: (type: any, status: any) => void;

                                            property triggerCombineEvent

                                            triggerCombineEvent: (
                                            mainEventName: any,
                                            eventStatus: any,
                                            ...args: any[]
                                            ) => void;

                                              property triggerEvent

                                              triggerEvent: (name: any, ...args: any[]) => void;

                                                property triggerPinchEvent

                                                triggerPinchEvent: (
                                                mainEventName: any,
                                                eventStatus: any,
                                                ...args: any[]
                                                ) => void;

                                                  property triggerSubEvent

                                                  triggerSubEvent: (mainEventName: any, eventStatus: any, ...args: any[]) => void;

                                                    property triggerUserCb

                                                    triggerUserCb: (status: any, e: any) => void;

                                                      property updateGestureStatus

                                                      updateGestureStatus: (e: any) => void;

                                                        method componentWillUnmount

                                                        componentWillUnmount: () => void;

                                                          method render

                                                          render: () => React.ReactElement<any>;


                                                            interface IGesture

                                                            interface IGesture {}

                                                              property direction

                                                              direction?: 'all' | 'vertical' | 'horizontal';

                                                                property enablePinch

                                                                enablePinch?: boolean;

                                                                  property enableRotate

                                                                  enableRotate?: boolean;

                                                                    property onPan

                                                                    onPan?: GestureHandler;

                                                                      property onPanCancel

                                                                      onPanCancel?: GestureHandler;

                                                                        property onPanDown

                                                                        onPanDown?: GestureHandler;

                                                                          property onPanEnd

                                                                          onPanEnd?: GestureHandler;

                                                                            property onPanLeft

                                                                            onPanLeft?: GestureHandler;

                                                                              property onPanMove

                                                                              onPanMove?: GestureHandler;

                                                                                property onPanRight

                                                                                onPanRight?: GestureHandler;

                                                                                  property onPanStart

                                                                                  onPanStart?: GestureHandler;

                                                                                    property onPanUp

                                                                                    onPanUp?: GestureHandler;

                                                                                      property onPinch

                                                                                      onPinch?: GestureHandler;

                                                                                        property onPinchCancel

                                                                                        onPinchCancel?: GestureHandler;

                                                                                          property onPinchEnd

                                                                                          onPinchEnd?: GestureHandler;

                                                                                            property onPinchIn

                                                                                            onPinchIn?: GestureHandler;

                                                                                              property onPinchMove

                                                                                              onPinchMove?: GestureHandler;

                                                                                                property onPinchOut

                                                                                                onPinchOut?: GestureHandler;

                                                                                                  property onPinchStart

                                                                                                  onPinchStart?: GestureHandler;

                                                                                                    property onPress

                                                                                                    onPress?: GestureHandler;

                                                                                                      property onPressUp

                                                                                                      onPressUp?: GestureHandler;

                                                                                                        property onRotate

                                                                                                        onRotate?: GestureHandler;

                                                                                                          property onRotateCancel

                                                                                                          onRotateCancel?: GestureHandler;

                                                                                                            property onRotateEnd

                                                                                                            onRotateEnd?: GestureHandler;

                                                                                                              property onRotateMove

                                                                                                              onRotateMove?: GestureHandler;

                                                                                                                property onRotateStart

                                                                                                                onRotateStart?: GestureHandler;

                                                                                                                  property onSwipe

                                                                                                                  onSwipe?: GestureHandler;

                                                                                                                    property onSwipeDown

                                                                                                                    onSwipeDown?: GestureHandler;

                                                                                                                      property onSwipeLeft

                                                                                                                      onSwipeLeft?: GestureHandler;

                                                                                                                        property onSwipeRight

                                                                                                                        onSwipeRight?: GestureHandler;

                                                                                                                          property onSwipeUp

                                                                                                                          onSwipeUp?: GestureHandler;

                                                                                                                            property onTap

                                                                                                                            onTap?: GestureHandler;

                                                                                                                              property onTouchCancel

                                                                                                                              onTouchCancel?: TouchEventHandler<HTMLElement>;

                                                                                                                                property onTouchEnd

                                                                                                                                onTouchEnd?: TouchEventHandler<HTMLElement>;

                                                                                                                                  property onTouchMove

                                                                                                                                  onTouchMove?: TouchEventHandler<HTMLElement>;

                                                                                                                                    property onTouchStart

                                                                                                                                    onTouchStart?: TouchEventHandler<HTMLElement>;

                                                                                                                                      interface IGestureStatus

                                                                                                                                      interface IGestureStatus {}

                                                                                                                                        property availablePan

                                                                                                                                        availablePan?: boolean;

                                                                                                                                          property direction

                                                                                                                                          direction?: number;

                                                                                                                                            property moveStatus

                                                                                                                                            moveStatus?: SingeFingerMoveStatus;

                                                                                                                                              property mutliFingerStatus

                                                                                                                                              mutliFingerStatus?: MultiFingerStatus[];

                                                                                                                                                property pan

                                                                                                                                                pan?: boolean;

                                                                                                                                                  property pinch

                                                                                                                                                  pinch?: boolean;

                                                                                                                                                    property press

                                                                                                                                                    press?: boolean;

                                                                                                                                                      property preTouches

                                                                                                                                                      preTouches: Finger[];

                                                                                                                                                        property rotate

                                                                                                                                                        rotate?: boolean;

                                                                                                                                                          property rotation

                                                                                                                                                          rotation?: number;

                                                                                                                                                            property scale

                                                                                                                                                            scale?: number;

                                                                                                                                                              property srcEvent

                                                                                                                                                              srcEvent: any;

                                                                                                                                                                property startMutliFingerStatus

                                                                                                                                                                startMutliFingerStatus?: MultiFingerStatus[];

                                                                                                                                                                  property startTime

                                                                                                                                                                  startTime: number;

                                                                                                                                                                    property startTouches

                                                                                                                                                                    startTouches: Finger[];

                                                                                                                                                                      property swipe

                                                                                                                                                                      swipe?: boolean;

                                                                                                                                                                        property time

                                                                                                                                                                        time: number;

                                                                                                                                                                          property touches

                                                                                                                                                                          touches: Finger[];

                                                                                                                                                                            Type Aliases

                                                                                                                                                                            type Finger

                                                                                                                                                                            type Finger = {
                                                                                                                                                                            x: number;
                                                                                                                                                                            y: number;

                                                                                                                                                                              type GestureHandler

                                                                                                                                                                              type GestureHandler = (s: IGestureStatus) => void;

                                                                                                                                                                                type MultiFingerStatus

                                                                                                                                                                                type MultiFingerStatus = {
                                                                                                                                                                                x: number;
                                                                                                                                                                                y: number;
                                                                                                                                                                                z: number;
                                                                                                                                                                                angle: number;

                                                                                                                                                                                  type SingeFingerMoveStatus

                                                                                                                                                                                  type SingeFingerMoveStatus = {
                                                                                                                                                                                  x: number;
                                                                                                                                                                                  y: number;
                                                                                                                                                                                  z: number;
                                                                                                                                                                                  time: number;
                                                                                                                                                                                  velocity: number;
                                                                                                                                                                                  angle: number;

                                                                                                                                                                                    Package Files (1)

                                                                                                                                                                                    Dependencies (1)

                                                                                                                                                                                    Dev Dependencies (11)

                                                                                                                                                                                    Peer Dependencies (0)

                                                                                                                                                                                    No peer dependencies.


                                                                                                                                                                                    To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                                                                    You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/rc-gesture.

                                                                                                                                                                                    • Markdown
                                                                                                                                                                                    • HTML
                                                                                                                                                                                      <a href="https://www.jsdocs.io/package/rc-gesture"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>