diff --git a/src/components/bottomSheet/BottomSheet.tsx b/src/components/bottomSheet/BottomSheet.tsx index 7ac1bbf53..74442cde3 100644 --- a/src/components/bottomSheet/BottomSheet.tsx +++ b/src/components/bottomSheet/BottomSheet.tsx @@ -73,6 +73,7 @@ import { INITIAL_SNAP_POINT, DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE, INITIAL_CONTAINER_OFFSET, + INITIAL_VALUE, } from './constants'; import type { BottomSheetMethods, Insets } from '../../types'; import type { BottomSheetProps, AnimateToPositionType } from './types'; @@ -210,7 +211,7 @@ const BottomSheetComponent = forwardRef( animateOnMount ? -1 : _providedIndex ); const animatedPosition = useSharedValue(INITIAL_POSITION); - const animatedNextPosition = useSharedValue(0); + const animatedNextPosition = useSharedValue(INITIAL_VALUE); const animatedNextPositionIndex = useSharedValue(0); // conditional @@ -651,8 +652,8 @@ const BottomSheetComponent = forwardRef( animatedAnimationSource.value = ANIMATION_SOURCE.NONE; animatedAnimationState.value = ANIMATION_STATE.STOPPED; - animatedNextPosition.value = Number.NEGATIVE_INFINITY; - animatedNextPositionIndex.value = Number.NEGATIVE_INFINITY; + animatedNextPosition.value = INITIAL_VALUE; + animatedNextPositionIndex.value = INITIAL_VALUE; } ); const animateToPosition: AnimateToPositionType = useWorkletCallback( diff --git a/src/components/bottomSheet/constants.ts b/src/components/bottomSheet/constants.ts index a30aaaecd..a08599191 100644 --- a/src/components/bottomSheet/constants.ts +++ b/src/components/bottomSheet/constants.ts @@ -20,6 +20,7 @@ const DEFAULT_KEYBOARD_BLUR_BEHAVIOR = KEYBOARD_BLUR_BEHAVIOR.none; const DEFAULT_KEYBOARD_INPUT_MODE = KEYBOARD_INPUT_MODE.adjustPan; // initial values +const INITIAL_VALUE = Number.NEGATIVE_INFINITY; const INITIAL_SNAP_POINT = -999; const INITIAL_CONTAINER_HEIGHT = -999; const INITIAL_CONTAINER_OFFSET = { @@ -49,4 +50,5 @@ export { INITIAL_CONTAINER_OFFSET, INITIAL_HANDLE_HEIGHT, INITIAL_SNAP_POINT, + INITIAL_VALUE, };