From a26bb40ef789edc2005f8e17dbc2003a305d1770 Mon Sep 17 00:00:00 2001 From: Konstantin Liakhovskii Date: Fri, 9 Jan 2026 18:26:17 -0800 Subject: [PATCH] Fix animatedPosition initialization logic Fixing this issue: https://github.com/gorhom/react-native-bottom-sheet/issues/2582 --- src/components/bottomSheet/BottomSheet.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/bottomSheet/BottomSheet.tsx b/src/components/bottomSheet/BottomSheet.tsx index 6748c93c..60eeef98 100644 --- a/src/components/bottomSheet/BottomSheet.tsx +++ b/src/components/bottomSheet/BottomSheet.tsx @@ -216,7 +216,11 @@ const BottomSheetComponent = forwardRef( const animatedCurrentIndex = useReactiveSharedValue( animateOnMount ? -1 : _providedIndex ); - const animatedPosition = useSharedValue(INITIAL_POSITION); + + const initialPosition = !animateOnMount + ? animatedDetentsState.get().detents?.[_providedIndex] + : undefined; + const animatedPosition = useSharedValue(initialPosition ?? INITIAL_POSITION); // conditional const isAnimatedOnMount = useSharedValue(