diff --git a/src/components/bottomSheet/BottomSheet.tsx b/src/components/bottomSheet/BottomSheet.tsx index c79181a5..7f55f478 100644 --- a/src/components/bottomSheet/BottomSheet.tsx +++ b/src/components/bottomSheet/BottomSheet.tsx @@ -6,6 +6,7 @@ import React, { useImperativeHandle, memo, useEffect, + useRef, } from 'react'; import { type Insets, Platform } from 'react-native'; import { State } from 'react-native-gesture-handler'; @@ -1854,14 +1855,21 @@ const BottomSheetComponent = forwardRef( [reduceMotion, handleOnChange, _providedOnClose] ); + /** + * Remember previously provided index, so that we don't cause + * unnecessary handleSnapToIndex + */ + const previousProvidedIndex = useRef(_providedIndex) + /** * React to `index` prop to snap the sheet to the new position. * * @alias onIndexChange */ useEffect(() => { - if (isAnimatedOnMount.value) { + if (isAnimatedOnMount.value && previousProvidedIndex.current !== _providedIndex) { handleSnapToIndex(_providedIndex); + previousProvidedIndex.current = _providedIndex } }, [_providedIndex, isAnimatedOnMount, handleSnapToIndex]); //#endregion