Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* global document */
import * as React from "react";
import { MouseEvent, useRef, useMemo } from "react";
import {
AttachTouch,
SwipeDirections,
Expand Down Expand Up @@ -91,7 +91,7 @@ function getHandlers(
): [
{
ref: (element: HTMLElement | null) => void;
onMouseDown?: (event: React.MouseEvent) => void;
onMouseDown?: (event: MouseEvent) => void;
},
AttachTouch
] {
Expand Down Expand Up @@ -368,13 +368,13 @@ function updateTransientState(

export function useSwipeable(options: SwipeableProps): SwipeableHandlers {
const { trackMouse } = options;
const transientState = React.useRef({ ...initialState });
const transientProps = React.useRef<SwipeablePropsWithDefaultOptions>({
const transientState = useRef({ ...initialState });
const transientProps = useRef<SwipeablePropsWithDefaultOptions>({
...defaultProps,
});

// track previous rendered props
const previousProps = React.useRef<SwipeablePropsWithDefaultOptions>({
const previousProps = useRef<SwipeablePropsWithDefaultOptions>({
...transientProps.current,
});
previousProps.current = { ...transientProps.current };
Expand All @@ -392,7 +392,7 @@ export function useSwipeable(options: SwipeableProps): SwipeableHandlers {
}
}

const [handlers, attachTouch] = React.useMemo(
const [handlers, attachTouch] = useMemo(
() =>
getHandlers(
(stateSetter) =>
Expand Down