@@ -536,15 +536,17 @@ const BottomSheetComponent = forwardRef<BottomSheet, BottomSheetProps>(
536536 ) ;
537537 // biome-ignore lint/correctness/useExhaustiveDependencies(BottomSheet.name): used for debug only
538538 const handleOnAnimate = useCallback (
539- function handleOnAnimate ( targetIndex : number ) {
539+ function handleOnAnimate ( targetIndex : number , targetPosition : number ) {
540540 if ( __DEV__ ) {
541541 print ( {
542542 component : BottomSheet . name ,
543543 method : handleOnAnimate . name ,
544544 category : 'callback' ,
545545 params : {
546546 toIndex : targetIndex ,
547+ toPosition : targetPosition ,
547548 fromIndex : animatedCurrentIndex . value ,
549+ fromPosition : animatedPosition . value ,
548550 } ,
549551 } ) ;
550552 }
@@ -554,10 +556,15 @@ const BottomSheetComponent = forwardRef<BottomSheet, BottomSheetProps>(
554556 }
555557
556558 if ( targetIndex !== animatedCurrentIndex . value ) {
557- _providedOnAnimate ( animatedCurrentIndex . value , targetIndex ) ;
559+ _providedOnAnimate (
560+ animatedCurrentIndex . value ,
561+ targetIndex ,
562+ animatedPosition . value ,
563+ targetPosition
564+ ) ;
558565 }
559566 } ,
560- [ _providedOnAnimate , animatedCurrentIndex ]
567+ [ _providedOnAnimate , animatedCurrentIndex , animatedPosition ]
561568 ) ;
562569 //#endregion
563570
@@ -643,10 +650,15 @@ const BottomSheetComponent = forwardRef<BottomSheet, BottomSheetProps>(
643650 animatedNextPosition . value = position ;
644651
645652 /**
646- * offset the position if keyboard is shown
653+ * offset the position if keyboard is shown,
654+ * and behavior not extend.
647655 */
648656 let offset = 0 ;
649- if ( animatedKeyboardState . value === KEYBOARD_STATE . SHOWN ) {
657+ if (
658+ animatedKeyboardState . value === KEYBOARD_STATE . SHOWN &&
659+ keyboardBehavior !== KEYBOARD_BEHAVIOR . extend &&
660+ position < animatedPosition . value
661+ ) {
650662 offset = animatedKeyboardHeightInContainer . value ;
651663 }
652664
@@ -657,7 +669,7 @@ const BottomSheetComponent = forwardRef<BottomSheet, BottomSheetProps>(
657669 /**
658670 * fire `onAnimate` callback
659671 */
660- runOnJS ( handleOnAnimate ) ( animatedNextPositionIndex . value ) ;
672+ runOnJS ( handleOnAnimate ) ( animatedNextPositionIndex . value , position ) ;
661673
662674 /**
663675 * start animation
@@ -672,6 +684,7 @@ const BottomSheetComponent = forwardRef<BottomSheet, BottomSheetProps>(
672684 } ,
673685 [
674686 handleOnAnimate ,
687+ keyboardBehavior ,
675688 _providedAnimationConfigs ,
676689 _providedOverrideReduceMotion ,
677690 ]
0 commit comments