Skip to content

Commit

Permalink
fix: check if next and current indices are different before animating…
Browse files Browse the repository at this point in the history
… to a snap position (#1095)(by @itsramiel)
  • Loading branch information
itsramiel committed Sep 9, 2022
1 parent 8fc11fd commit 3b75d5d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/bottomSheet/BottomSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1315,7 +1315,10 @@ const BottomSheetComponent = forwardRef<BottomSheet, BottomSheetProps>(
* if snap points changed while sheet is animating, then
* we stop the animation and animate to the updated point.
*/
if (animatedAnimationState.value === ANIMATION_STATE.RUNNING) {
if (
animatedAnimationState.value === ANIMATION_STATE.RUNNING &&
animatedNextPositionIndex.value !== animatedCurrentIndex.value
) {
nextPosition =
animatedNextPositionIndex.value !== -1
? snapPoints[animatedNextPositionIndex.value]
Expand Down

0 comments on commit 3b75d5d

Please sign in to comment.