Skip to content

Commit d9b417f

Browse files
committed
fix: prevent animated content height value from getting below zero
1 parent 7cfe70d commit d9b417f

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/components/bottomSheet/BottomSheet.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,16 @@ const BottomSheetComponent = forwardRef<BottomSheet, BottomSheetProps>(
338338
const animatedContentHeight = useDerivedValue(() => {
339339
const contentHeight =
340340
animatedSheetHeight.value - animatedHandleHeight.value;
341+
342+
/**
343+
* before the container is measured, `contentHeight` value will be below zero,
344+
* which will lead to freeze the scrollable on Android.
345+
*
346+
* @link (https://github.com/gorhom/react-native-bottom-sheet/issues/470)
347+
*/
348+
if (contentHeight <= 0) {
349+
return 0;
350+
}
341351
const keyboardHeightInContainer = getKeyboardHeightInContainer();
342352

343353
if (

0 commit comments

Comments
 (0)