@@ -567,6 +567,10 @@ const BottomSheetComponent = forwardRef<BottomSheet, BottomSheetProps>(
567
567
return animatedPosition . value ;
568
568
}
569
569
570
+ if ( ! isAnimatedOnMount . value ) {
571
+ return snapPoints [ _providedIndex ] ;
572
+ }
573
+
570
574
return snapPoints [ currentIndex ] ;
571
575
} ,
572
576
[
@@ -579,8 +583,10 @@ const BottomSheetComponent = forwardRef<BottomSheet, BottomSheetProps>(
579
583
animatedPosition ,
580
584
animatedSnapPoints ,
581
585
isInTemporaryPosition ,
586
+ isAnimatedOnMount ,
582
587
keyboardBehavior ,
583
588
keyboardBlurBehavior ,
589
+ _providedIndex ,
584
590
]
585
591
) ;
586
592
const handleOnChange = useCallback (
@@ -1238,7 +1244,7 @@ const BottomSheetComponent = forwardRef<BottomSheet, BottomSheetProps>(
1238
1244
nextPosition = animatedClosedPosition . value ;
1239
1245
animatedNextPositionIndex . value = - 1 ;
1240
1246
} else {
1241
- nextPosition = animatedSnapPoints . value [ _providedIndex ] ;
1247
+ nextPosition = getNextPosition ( ) ;
1242
1248
}
1243
1249
1244
1250
runOnJS ( print ) ( {
@@ -1371,37 +1377,52 @@ const BottomSheetComponent = forwardRef<BottomSheet, BottomSheetProps>(
1371
1377
)
1372
1378
: Math . abs ( _keyboardHeight - animatedContainerOffset . value . bottom ) ;
1373
1379
1380
+ /**
1381
+ * if keyboard state is equal to the previous state, then exit the method
1382
+ */
1383
+ if (
1384
+ _keyboardState === _previousKeyboardState &&
1385
+ _keyboardHeight === _previousKeyboardHeight
1386
+ ) {
1387
+ return ;
1388
+ }
1389
+
1390
+ /**
1391
+ * if user is interacting with sheet, then exit the method
1392
+ */
1374
1393
const hasActiveGesture =
1375
1394
animatedContentGestureState . value === State . ACTIVE ||
1376
1395
animatedContentGestureState . value === State . BEGAN ||
1377
1396
animatedHandleGestureState . value === State . ACTIVE ||
1378
1397
animatedHandleGestureState . value === State . BEGAN ;
1398
+ if ( hasActiveGesture ) {
1399
+ return ;
1400
+ }
1401
+
1402
+ /**
1403
+ * if sheet not animated on mount yet, then exit the method
1404
+ */
1405
+ if ( ! isAnimatedOnMount . value ) {
1406
+ return ;
1407
+ }
1408
+
1409
+ /**
1410
+ * if new keyboard state is hidden and blur behavior is none, then exit the method
1411
+ */
1412
+ if (
1413
+ _keyboardState === KEYBOARD_STATE . HIDDEN &&
1414
+ keyboardBlurBehavior === KEYBOARD_BLUR_BEHAVIOR . none
1415
+ ) {
1416
+ return ;
1417
+ }
1379
1418
1419
+ /**
1420
+ * if platform is android and the input mode is resize, then exit the method
1421
+ */
1380
1422
if (
1381
- /**
1382
- * if keyboard state is equal to the previous state, then exit the method
1383
- */
1384
- ( _keyboardState === _previousKeyboardState &&
1385
- _keyboardHeight === _previousKeyboardHeight ) ||
1386
- /**
1387
- * if user is interacting with sheet, then exit the method
1388
- */
1389
- hasActiveGesture ||
1390
- /**
1391
- * if sheet not animated on mount yet, then exit the method
1392
- */
1393
- ! isAnimatedOnMount . value ||
1394
- /**
1395
- * if new keyboard state is hidden and blur behavior is none, then exit the method
1396
- */
1397
- ( _keyboardState === KEYBOARD_STATE . HIDDEN &&
1398
- keyboardBlurBehavior === KEYBOARD_BLUR_BEHAVIOR . none ) ||
1399
- /**
1400
- * if platform is android and the input mode is resize, then exit the method
1401
- */
1402
- ( Platform . OS === 'android' &&
1403
- keyboardBehavior === KEYBOARD_BEHAVIOR . interactive &&
1404
- android_keyboardInputMode === KEYBOARD_INPUT_MODE . adjustResize )
1423
+ Platform . OS === 'android' &&
1424
+ keyboardBehavior === KEYBOARD_BEHAVIOR . interactive &&
1425
+ android_keyboardInputMode === KEYBOARD_INPUT_MODE . adjustResize
1405
1426
) {
1406
1427
animatedKeyboardHeightInContainer . value = 0 ;
1407
1428
return ;
0 commit comments