Story tray/creation/viewer with PawRing seen/unseen indicator, expo-video playback for VIDEO posts (replacing the static placeholder), and a pets/people/hashtags search screen reachable from the Explore tab header. Extracts FollowButton from the pet-profile screen since search results need the same follow/unfollow toggle. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
14 lines
376 B
TypeScript
14 lines
376 B
TypeScript
import { useEffect, useState } from "react";
|
|
|
|
/** Port of web's src/hooks/use-debounce.ts. */
|
|
export function useDebounce<T>(value: T, delayMs: number): T {
|
|
const [debounced, setDebounced] = useState(value);
|
|
|
|
useEffect(() => {
|
|
const id = setTimeout(() => setDebounced(value), delayMs);
|
|
return () => clearTimeout(id);
|
|
}, [value, delayMs]);
|
|
|
|
return debounced;
|
|
}
|