diff --git a/src/components/bottomSheet/BottomSheet.tsx b/src/components/bottomSheet/BottomSheet.tsx index b16644070..b5374e81d 100644 --- a/src/components/bottomSheet/BottomSheet.tsx +++ b/src/components/bottomSheet/BottomSheet.tsx @@ -602,8 +602,9 @@ const BottomSheetComponent = forwardRef( ); const handleOnAnimate = useCallback( function handleOnAnimate(toPoint: number) { + const keyboardOffset = animatedKeyboardState.value == KEYBOARD_STATE.SHOWN ? animatedKeyboardHeight.value : 0; const snapPoints = animatedSnapPoints.value; - const toIndex = snapPoints.indexOf(toPoint); + const toIndex = toPoint == 0 ? INITIAL_SNAP_POINT : snapPoints.indexOf(toPoint + keyboardOffset); print({ component: BottomSheet.name, @@ -693,9 +694,10 @@ const BottomSheetComponent = forwardRef( /** * store next position */ - animatedNextPosition.value = position; - animatedNextPositionIndex.value = - animatedSnapPoints.value.indexOf(position); + const keyboardOffset = animatedKeyboardState.value == KEYBOARD_STATE.SHOWN ? animatedKeyboardHeight.value : 0; + + animatedNextPosition.value = position + keyboardOffset; + animatedNextPositionIndex.value = position == 0 ? INITIAL_SNAP_POINT : animatedSnapPoints.value.indexOf(position + keyboardOffset); /** * fire `onAnimate` callback