Skip to content

Commit 5f6122d

Browse files
authored
Fix for dynamic snap points (#52)
Without this change, if your item starts with any side closed (no snap points), and later on you update the snap points to enable that side, the side renders empty (or rather it renders but has opacity: 0 so you cannot see the underlay).
1 parent 36c5dc7 commit 5f6122d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,12 @@ function SwipeableItem<T>(
144144
return swipingLeft.value && maxSnapPointLeft
145145
? Math.abs(animStatePos.value / maxSnapPointLeft)
146146
: 0;
147-
}, []);
147+
}, [maxSnapPointLeft]);
148148
const percentOpenRight = useDerivedValue(() => {
149149
return swipingRight.value && maxSnapPointRight
150150
? Math.abs(animStatePos.value / maxSnapPointRight)
151151
: 0;
152-
}, []);
152+
}, [maxSnapPointRight]);
153153

154154
const hasLeft = !!snapPointsLeft?.length;
155155
const hasRight = !!snapPointsRight?.length;

0 commit comments

Comments
 (0)