Skip to content

Commit

Permalink
enhance: (FloatingPanel) prevent body scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
awmleer committed Feb 9, 2022
1 parent a9be6e6 commit 1441928
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/components/floating-panel/floating-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { useSpring, animated } from '@react-spring/web'
import { supportsPassive } from '../../utils/supports-passive'
import { nearest } from '../../utils/nearest'
import { mergeProps } from '../../utils/with-default-props'
import { useLockScroll } from '../../utils/use-lock-scroll'

export type FloatingPanelRef = {
setHeight: (
Expand Down Expand Up @@ -127,6 +128,8 @@ export const FloatingPanel = forwardRef<FloatingPanelRef, FloatingPanelProps>(
[api]
)

useLockScroll(elementRef, true)

return withNativeProps(
props,
<animated.div
Expand Down

0 comments on commit 1441928

Please sign in to comment.