A performant interactive bottom sheet library for React Native that provides smooth gesture-driven interactions with fully configurable options. Built with TypeScript and React Native Reanimated v3, it supports various scrollable content types, keyboard handling, modal presentation, and accessibility features.
npm install @gorhom/bottom-sheetreact-native-reanimated@>=3.16.0react-native-gesture-handler@>=2.16.1import BottomSheet, {
BottomSheetModal,
BottomSheetModalProvider,
useBottomSheet,
useBottomSheetModal
} from "@gorhom/bottom-sheet";For specific components:
import {
BottomSheetScrollView,
BottomSheetFlatList,
BottomSheetSectionList,
BottomSheetHandle,
BottomSheetBackdrop,
BottomSheetTextInput
} from "@gorhom/bottom-sheet";import React, { useRef, useMemo } from 'react';
import { View, Text } from 'react-native';
import BottomSheet from '@gorhom/bottom-sheet';
const MyComponent = () => {
const bottomSheetRef = useRef<BottomSheet>(null);
const snapPoints = useMemo(() => ['25%', '50%', '90%'], []);
return (
<View style={{ flex: 1 }}>
{/* App content */}
<View style={{ flex: 1, backgroundColor: 'grey' }} />
{/* Bottom Sheet */}
<BottomSheet
ref={bottomSheetRef}
index={1}
snapPoints={snapPoints}
>
<View style={{ flex: 1, alignItems: 'center' }}>
<Text>Awesome ๐</Text>
</View>
</BottomSheet>
</View>
);
};Bottom Sheet is built around several key components:
BottomSheet provides the main interface with gesture handling and snap points, while BottomSheetModal offers modal presentationPrimary bottom sheet component with gesture-driven interactions, snap points, and extensive configuration options.
interface BottomSheetProps {
index?: number;
snapPoints?: Array<string | number> | SharedValue<Array<string | number>>;
enableDynamicSizing?: boolean;
enablePanDownToClose?: boolean;
children: React.ReactNode;
// ... extensive configuration options
}
export default function BottomSheet(props: BottomSheetProps): JSX.Element;Modal bottom sheets that overlay the entire screen with stack management and presentation controls.
interface BottomSheetModalProps<T = any> extends Omit<BottomSheetProps, 'containerHeight' | 'onClose'> {
name?: string;
stackBehavior?: 'push' | 'switch' | 'replace';
enableDismissOnClose?: boolean;
onDismiss?: () => void;
}
declare const BottomSheetModal: React.ForwardRefExoticComponent<BottomSheetModalProps>;
declare const BottomSheetModalProvider: React.FC<{ children?: React.ReactNode }>;Optimized scrollable components that integrate seamlessly with bottom sheet gestures and provide proper interaction handling.
interface BottomSheetScrollableProps {
enableFooterMarginAdjustment?: boolean;
focusHook?: (effect: EffectCallback, deps?: DependencyList) => void;
scrollEventsHandlersHook?: ScrollEventsHandlersHookType;
}
declare const BottomSheetScrollView: React.ForwardRefExoticComponent<BottomSheetScrollViewProps>;
declare const BottomSheetFlatList: React.ForwardRefExoticComponent<BottomSheetFlatListProps<any>>;
declare const BottomSheetSectionList: React.ForwardRefExoticComponent<BottomSheetSectionListProps<any, any>>;Hooks for imperative control of bottom sheets, accessing animated values, and managing modal presentation.
interface BottomSheetMethods {
snapToIndex: (index: number, animationConfigs?: WithSpringConfig | WithTimingConfig) => void;
snapToPosition: (position: number | string, animationConfigs?: WithSpringConfig | WithTimingConfig) => void;
expand: (animationConfigs?: WithSpringConfig | WithTimingConfig) => void;
collapse: (animationConfigs?: WithSpringConfig | WithTimingConfig) => void;
close: (animationConfigs?: WithSpringConfig | WithTimingConfig) => void;
}
interface BottomSheetVariables {
animatedIndex: SharedValue<number>;
animatedPosition: SharedValue<number>;
}
declare function useBottomSheet(): BottomSheetMethods & BottomSheetVariables;
declare function useBottomSheetModal(): { dismiss: (key?: string) => boolean; dismissAll: () => void };Hooks for creating and customizing animation configurations for bottom sheet movements.
declare function useBottomSheetSpringConfigs(
configs: Omit<WithSpringConfig, 'velocity'>
): Omit<WithSpringConfig, 'velocity'>;
declare function useBottomSheetTimingConfigs(
configs: TimingConfig
): TimingConfig;
interface TimingConfig {
duration?: number;
reduceMotion?: ReduceMotion;
easing?: EasingFunction | EasingFunctionFactory;
}Specialized UI components including handles, backdrops, footers, and input components optimized for bottom sheet interactions.
interface BottomSheetHandleProps {
animatedIndex: SharedValue<number>;
animatedPosition: SharedValue<number>;
}
interface BottomSheetBackdropProps extends BottomSheetVariables {
style?: ViewStyle;
}
declare const BottomSheetHandle: React.FC<BottomSheetHandleProps>;
declare const BottomSheetBackdrop: React.FC<BottomSheetBackdropProps>;
declare const BottomSheetTextInput: React.ForwardRefExoticComponent<TextInputProps>;Advanced hooks for customizing gesture behavior, scroll event handling, and coordinating interactions between components.
type GestureEventsHandlersHookType = () => {
handleOnStart: GestureEventHandlerCallbackType;
handleOnChange: GestureEventHandlerCallbackType;
handleOnEnd: GestureEventHandlerCallbackType;
handleOnFinalize: GestureEventHandlerCallbackType;
};
type ScrollEventsHandlersHookType = (
ref: React.RefObject<Scrollable>,
contentOffsetY: SharedValue<number>
) => ScrollEventHandlers;
declare function useGestureEventsHandlersDefault(): GestureEventHandlers;
declare function useScrollEventsHandlersDefault(
scrollableRef: RefObject<Scrollable>,
scrollableContentOffsetY: SharedValue<number>
): ScrollEventHandlers;interface BottomSheetVariables {
animatedIndex: SharedValue<number>;
animatedPosition: SharedValue<number>;
}
interface BottomSheetMethods {
snapToIndex: (index: number, animationConfigs?: WithSpringConfig | WithTimingConfig) => void;
snapToPosition: (position: number | string, animationConfigs?: WithSpringConfig | WithTimingConfig) => void;
expand: (animationConfigs?: WithSpringConfig | WithTimingConfig) => void;
collapse: (animationConfigs?: WithSpringConfig | WithTimingConfig) => void;
close: (animationConfigs?: WithSpringConfig | WithTimingConfig) => void;
forceClose: (animationConfigs?: WithSpringConfig | WithTimingConfig) => void;
}
interface BottomSheetModalMethods<T = any> extends BottomSheetMethods {
present: (data?: T) => void;
dismiss: (animationConfigs?: WithSpringConfig | WithTimingConfig) => void;
}
type Scrollable = FlatList | ScrollView | SectionList;
interface ContainerLayoutState {
height: number;
offset: Required<Insets>;
}
interface KeyboardState {
target?: number;
status: KEYBOARD_STATUS;
height: number;
heightWithinContainer: number;
easing: KeyboardEventEasing;
duration: number;
}/**
* Enable internal library logging for debugging (development only)
* @param excludeCategories - Optional categories to exclude from logging
*/
declare function enableLogging(excludeCategories?: Array<'layout' | 'effect' | 'callback'>): void;