MCPcopy Create free account
hub / github.com/FormidableLabs/react-swipeable / SwipeableUsingHook

Function SwipeableUsingHook

__tests__/useSwipeable.spec.tsx:34–57  ·  view source on GitHub ↗
({
  nodeName = "div",
  onRefPassThrough,
  ...rest
}: SwipeableProps & {
  nodeName?: string;
  onRefPassThrough?(el: HTMLElement): void;
})

Source from the content-addressed store, hash-verified

32 * Wrapping component for the hook testing
33 */
34function SwipeableUsingHook({
35 nodeName = "div",
36 onRefPassThrough,
37 ...rest
38}: SwipeableProps & {
39 nodeName?: string;
40 onRefPassThrough?(el: HTMLElement): void;
41}) {
42 const eventHandlers = useSwipeable(rest);
43 const Elem = nodeName as React.ElementType;
44
45 const refPassthrough = (el: HTMLElement) => {
46 onRefPassThrough?.(el);
47
48 // call useSwipeable ref prop with el
49 eventHandlers.ref(el);
50 };
51
52 return (
53 <Elem {...eventHandlers} ref={refPassthrough}>
54 <span>{TESTING_TEXT}</span>
55 </Elem>
56 );
57}
58
59const MD = "mouseDown";
60const MM = "mouseMove";

Callers

nothing calls this directly

Calls 1

useSwipeableFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…