UNPKG

@gorhom/bottom-sheet

Version:

A performant interactive bottom sheet with fully configurable options 🚀

26 lines (20 loc) • 645 B
import { useContext } from 'react'; import { BottomSheetInternalContext, type BottomSheetInternalContextType, } from '../contexts/internal'; export function useBottomSheetInternal( unsafe?: false ): BottomSheetInternalContextType; export function useBottomSheetInternal( unsafe: true ): BottomSheetInternalContextType | null; export function useBottomSheetInternal( unsafe?: boolean ): BottomSheetInternalContextType | null { const context = useContext(BottomSheetInternalContext); if (unsafe !== true && context === null) { throw "'useBottomSheetInternal' cannot be used out of the BottomSheet!"; } return context; }