Skip to content

Instantly share code, notes, and snippets.

@maha-siva-dev
maha-siva-dev / useKeypress.ts
Created February 14, 2024 16:27 — forked from KristofferEriksson/useKeypress.ts
A React custom hook for handling keyboard events.
import { useEffect } from "react";
const Keys = {
Backspace: "Backspace",
Tab: "Tab",
Enter: "Enter",
Shift: "Shift",
Control: "Control",
Alt: "Alt",
Pause: "Pause",
@maha-siva-dev
maha-siva-dev / useShare.ts
Created February 8, 2024 17:05 — forked from KristofferEriksson/useShare.ts
A React Typescript hook that let users share your content directly via native share dialogs
import { useCallback, useEffect, useState } from "react";
// Types for the useShare hook parameters
interface UseShareParams {
onShare?: (content: ShareParams) => void;
onSuccess?: (content: ShareParams) => void;
onError?: (error: any) => void;
fallback?: () => void;
successTimeout?: number;
}
@maha-siva-dev
maha-siva-dev / useGesture.ts
Created February 8, 2024 03:46 — forked from KristofferEriksson/useGesture.ts
A custom React Typescript hook for advanced touch gestures in UI
import { useEffect, useRef } from "react";
type GestureType =
| "swipeUp"
| "swipeDown"
| "swipeLeft"
| "swipeRight"
| "tap"
| "pinch"
| "zoom";