Skip to content

Commit d77ee00

Browse files
committed
fix: shouldFade prop must be reactive
1 parent 4ea8916 commit d77ee00

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

lib/Drawer/components/Root.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ function onDrag(event: PointerEvent) {
431431
432432
const opacityValue = 1 - percentageDragged;
433433
434-
if (shouldFade || (fadeFromIndex && activeSnapPointIndex.value === fadeFromIndex - 1)) {
434+
if (shouldFade.value || (fadeFromIndex && activeSnapPointIndex.value === fadeFromIndex - 1)) {
435435
onDragProp?.(event, percentageDragged);
436436
437437
set(

lib/Drawer/useSnapPoints.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,14 @@ export function useSnapPoints({
6969

7070
const activeSnapPointIndex = computed(() => snapPoints?.findIndex((snapPoint) => snapPoint === activeSnapPoint.value) ?? null)
7171

72-
const shouldFade =
72+
const shouldFade = computed(() => (
7373
(snapPoints &&
7474
snapPoints.length > 0 &&
7575
(fadeFromIndex || fadeFromIndex === 0) &&
7676
!Number.isNaN(fadeFromIndex) &&
7777
snapPoints[fadeFromIndex] === activeSnapPoint.value
78-
) || !snapPoints
78+
) || !snapPoints)
79+
)
7980

8081
const snapPointsOffset = computed(() => {
8182
const containerSize = typeof window !== 'undefined'
@@ -259,7 +260,7 @@ export function useSnapPoints({
259260

260261
// Don't animate, but still use this one if we are dragging away from the overlaySnapPoint
261262
if (isOverlaySnapPoint && !isDraggingDown) return 1;
262-
if (!shouldFade && !isOverlaySnapPoint) return null;
263+
if (!shouldFade.value && !isOverlaySnapPoint) return null;
263264

264265
// Either fadeFrom index or the one before
265266
const targetSnapPointIndex = isOverlaySnapPoint ? activeSnapPointIndex.value + 1 : activeSnapPointIndex.value - 1;

0 commit comments

Comments
 (0)