@@ -685,6 +685,7 @@ const BottomSheetComponent = forwardRef<BottomSheet, BottomSheetProps>(
685
685
currentPosition : animatedPosition . value ,
686
686
position,
687
687
velocity,
688
+ animatedContainerHeight : animatedContainerHeight . value ,
688
689
} ,
689
690
} ) ;
690
691
@@ -1297,6 +1298,31 @@ const BottomSheetComponent = forwardRef<BottomSheet, BottomSheetProps>(
1297
1298
const _previousSnapPoints = _previousResult ?. snapPoints ;
1298
1299
const _previousContainerHeight = _previousResult ?. containerHeight ;
1299
1300
1301
+ let nextPosition ;
1302
+ let animationConfig ;
1303
+ let animationSource = ANIMATION_SOURCE . SNAP_POINT_CHANGE ;
1304
+
1305
+ /**
1306
+ * if the bottom sheet is closing and the container gets resized,
1307
+ * then we restart the closing animation to the new position.
1308
+ */
1309
+ if (
1310
+ animatedAnimationState . value === ANIMATION_STATE . RUNNING &&
1311
+ animatedNextPositionIndex . value === - 1 &&
1312
+ _previousContainerHeight !== containerHeight
1313
+ ) {
1314
+ animationSource = ANIMATION_SOURCE . CONTAINER_RESIZE ;
1315
+ animationConfig = {
1316
+ duration : 0 ,
1317
+ } ;
1318
+ animateToPosition (
1319
+ containerHeight ,
1320
+ animationSource ,
1321
+ 0 ,
1322
+ animationConfig
1323
+ ) ;
1324
+ }
1325
+
1300
1326
if (
1301
1327
JSON . stringify ( snapPoints ) === JSON . stringify ( _previousSnapPoints ) ||
1302
1328
! isLayoutCalculated . value ||
@@ -1314,10 +1340,6 @@ const BottomSheetComponent = forwardRef<BottomSheet, BottomSheetProps>(
1314
1340
} ,
1315
1341
} ) ;
1316
1342
1317
- let nextPosition ;
1318
- let animationConfig ;
1319
- let animationSource = ANIMATION_SOURCE . SNAP_POINT_CHANGE ;
1320
-
1321
1343
/**
1322
1344
* if snap points changed while sheet is animating, then
1323
1345
* we stop the animation and animate to the updated point.
0 commit comments