Skip to content

Commit

Permalink
fix: fade out correctly on snap
Browse files Browse the repository at this point in the history
  • Loading branch information
stipsan committed Dec 4, 2020
1 parent 07693f3 commit 17234bc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/hooks/useSnapResponder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
*/

import { useCallback, useEffect, useRef, useState } from 'react'
import { clamp } from '../utils'
import { useSnapPoints, useSpring } from './index'

export function useSnapResponder({
Expand Down Expand Up @@ -96,7 +97,11 @@ export function useSnapResponder({
console.log({ snap })
heightRef.current = snap
lastSnapRef.current = snap
set({ y: snap, immediate: prefersReducedMotion.current })
set({
y: snap,
backdrop: clamp(snap / minSnapRef.current, 0, 1),
immediate: prefersReducedMotion.current,
})
}
}, [draggingRef, findSnap, heightRef, lastSnapRef, prefersReducedMotion, set])

Expand Down

0 comments on commit 17234bc

Please sign in to comment.