import { createContext, RefObject } from 'react'; import type { PanGestureHandlerProps, State, } from 'react-native-gesture-handler'; import type Animated from 'react-native-reanimated'; import type { AnimateToPositionType, BottomSheetProps, } from '../components/bottomSheet/types'; import type { ANIMATION_STATE, KEYBOARD_STATE, SCROLLABLE_STATE, SCROLLABLE_TYPE, SHEET_STATE, } from '../constants'; import type { Scrollable, ScrollableRef } from '../types'; export interface BottomSheetInternalContextType extends Pick< PanGestureHandlerProps, | 'activeOffsetY' | 'activeOffsetX' | 'failOffsetY' | 'failOffsetX' | 'waitFor' | 'simultaneousHandlers' >, Required< Pick< BottomSheetProps, | 'enableContentPanningGesture' | 'enableOverDrag' | 'enablePanDownToClose' | 'onBeforeHandlePan' | 'enableDynamicSizing' | 'overDragResistanceFactor' > > { // animated states animatedAnimationState: Animated.SharedValue; animatedSheetState: Animated.SharedValue; animatedScrollableState: Animated.SharedValue; animatedKeyboardState: Animated.SharedValue; animatedContentGestureState: Animated.SharedValue; animatedHandleGestureState: Animated.SharedValue; // animated values animatedSnapPoints: Animated.SharedValue; animatedPosition: Animated.SharedValue; animatedIndex: Animated.SharedValue; animatedContainerHeight: Animated.SharedValue; animatedContentHeight: Animated.SharedValue; animatedHighestSnapPoint: Animated.SharedValue; animatedClosedPosition: Animated.SharedValue; animatedFooterHeight: Animated.SharedValue; animatedHandleHeight: Animated.SharedValue; animatedKeyboardHeight: Animated.SharedValue; animatedKeyboardHeightInContainer: Animated.SharedValue; animatedScrollableType: Animated.SharedValue; animatedScrollableContentOffsetY: Animated.SharedValue; animatedScrollableOverrideState: Animated.SharedValue; isScrollableRefreshable: Animated.SharedValue; isContentHeightFixed: Animated.SharedValue; isInTemporaryPosition: Animated.SharedValue; shouldHandleKeyboardEvents: Animated.SharedValue; // methods stopAnimation: () => void; animateToPosition: AnimateToPositionType; setScrollableRef: (ref: ScrollableRef) => void; removeScrollableRef: (ref: RefObject) => void; } export const BottomSheetInternalContext = createContext(null); export const BottomSheetInternalProvider = BottomSheetInternalContext.Provider;