Skip to content

Commit 17234bc

Browse files
committed
fix: fade out correctly on snap
1 parent 07693f3 commit 17234bc

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/hooks/useSnapResponder.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
*/
3434

3535
import { useCallback, useEffect, useRef, useState } from 'react'
36+
import { clamp } from '../utils'
3637
import { useSnapPoints, useSpring } from './index'
3738

3839
export function useSnapResponder({
@@ -96,7 +97,11 @@ export function useSnapResponder({
9697
console.log({ snap })
9798
heightRef.current = snap
9899
lastSnapRef.current = snap
99-
set({ y: snap, immediate: prefersReducedMotion.current })
100+
set({
101+
y: snap,
102+
backdrop: clamp(snap / minSnapRef.current, 0, 1),
103+
immediate: prefersReducedMotion.current,
104+
})
100105
}
101106
}, [draggingRef, findSnap, heightRef, lastSnapRef, prefersReducedMotion, set])
102107

0 commit comments

Comments
 (0)