import React, { createContext, useContext, useMemo, } from 'react'; import type { ViewStyle } from 'react-native'; type CustomStyles = { wrapper?: ViewStyle; container?: ViewStyle; draggableIcon?: ViewStyle; }; export interface ZeroSheetProviderProps { children: React.ReactNode; draggable?: boolean; backgroundColor?: string; backdrop?: boolean; closeByBackdropClick?: boolean; customStyles?: CustomStyles; draggableHeight?: number; buttonColor?: string; noBottomInset?: boolean; noTopInset?: boolean; extraTopInset?: number; extraBottomInset?: number; } interface ZeroSheetConfig { draggable: boolean; backgroundColor: string; backdrop: boolean; closeByBackdropClick: boolean; customStyles: CustomStyles; draggableHeight: number; buttonColor?: string; noBottomInset: boolean; noTopInset: boolean; extraTopInset: number; extraBottomInset: number; } const ZeroSheetConfigContext = createContext(null); export const ZeroSheetProvider: React.FC = ({ children, draggable = true, backgroundColor = '#fff', backdrop = true, closeByBackdropClick = true, customStyles = {}, draggableHeight = 25, buttonColor, noBottomInset = false, noTopInset = false, extraTopInset = 0, extraBottomInset = 0, }) => { const config = useMemo(() => ({ draggable, backgroundColor, backdrop, closeByBackdropClick, customStyles, draggableHeight, buttonColor, noBottomInset, noTopInset, extraTopInset, extraBottomInset, }), [ draggable, backgroundColor, backdrop, closeByBackdropClick, customStyles, draggableHeight, buttonColor, noBottomInset, noTopInset, extraTopInset, extraBottomInset, ]); return ( {children} ); }; export const useZeroSheetConfig = (): ZeroSheetConfig | null => { return useContext(ZeroSheetConfigContext); };