@@ -77,6 +77,7 @@ import {
7777 DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE ,
7878 DEFAULT_KEYBOARD_BEHAVIOR ,
7979 DEFAULT_KEYBOARD_BLUR_BEHAVIOR ,
80+ DEFAULT_KEYBOARD_INDEX ,
8081 DEFAULT_KEYBOARD_INPUT_MODE ,
8182 DEFAULT_OVER_DRAG_RESISTANCE_FACTOR ,
8283 INITIAL_POSITION ,
@@ -552,10 +553,6 @@ const BottomSheetComponent = forwardRef<BottomSheet, BottomSheetProps>(
552553 return ;
553554 }
554555
555- if ( animatedAnimationState . get ( ) . source === ANIMATION_SOURCE . MOUNT ) {
556- isAnimatedOnMount . value = true ;
557- }
558-
559556 // callbacks
560557 if ( nextIndex !== animatedCurrentIndex . get ( ) ) {
561558 runOnJS ( handleOnChange ) ( nextIndex , nextPosition ) ;
@@ -568,14 +565,15 @@ const BottomSheetComponent = forwardRef<BottomSheet, BottomSheetProps>(
568565 animatedCurrentIndex . set ( nextIndex ) ;
569566
570567 // reset values
568+ animatedContainerHeightDidChange . set ( false ) ;
569+ isAnimatedOnMount . set ( true ) ;
571570 animatedAnimationState . set ( {
572571 status : ANIMATION_STATUS . STOPPED ,
573572 source : ANIMATION_SOURCE . NONE ,
574573 nextIndex : undefined ,
575574 nextPosition : undefined ,
576575 isForcedClosing : undefined ,
577576 } ) ;
578- animatedContainerHeightDidChange . value = false ;
579577 } ,
580578 [
581579 handleOnChange ,
@@ -642,21 +640,21 @@ const BottomSheetComponent = forwardRef<BottomSheet, BottomSheetProps>(
642640 ) {
643641 offset = heightWithinContainer ;
644642 }
645-
646643 const { detents } = animatedDetentsState . get ( ) ;
647644 let index = detents ?. indexOf ( position + offset ) ?? - 1 ;
648645
649646 /**
650647 * because keyboard position is not part of the detents array,
651- * we need to keep the index to the current index.
648+ * we will need to manually set the index to the highest detent index.
652649 */
653650 if (
654651 index === - 1 &&
655652 status === KEYBOARD_STATUS . SHOWN &&
656- source === ANIMATION_SOURCE . KEYBOARD &&
657- isInTemporaryPosition . get ( )
653+ source === ANIMATION_SOURCE . KEYBOARD
658654 ) {
659- index = animatedCurrentIndex . value ;
655+ index =
656+ animatedDetentsState . get ( ) . highestDetentPosition ??
657+ DEFAULT_KEYBOARD_INDEX ;
660658 }
661659
662660 /**
@@ -700,8 +698,6 @@ const BottomSheetComponent = forwardRef<BottomSheet, BottomSheetProps>(
700698 animatedAnimationState ,
701699 animatedKeyboardState ,
702700 animatedPosition ,
703- animatedCurrentIndex ,
704- isInTemporaryPosition ,
705701 ]
706702 ) ;
707703 /**
0 commit comments