UNPKG

@gorhom/bottom-sheet

Version:

A performant interactive bottom sheet with fully configurable options 🚀

21 lines (20 loc) • 517 B
"use strict"; import { useCallback, useEffect, useLayoutEffect, useRef } from 'react'; /** * Provide a stable version of useCallback. */ export function useStableCallback(callback) { const callbackRef = useRef(); useLayoutEffect(() => { callbackRef.current = callback; }); useEffect(() => { return () => { callbackRef.current = undefined; }; }, []); return useCallback((...args) => { return callbackRef.current?.(...args); }, []); } //# sourceMappingURL=useStableCallback.js.map