import React, { ReactNode } from 'react'; import { TouchableOpacity, useWindowDimensions } from 'react-native'; import { useSafeAreaPadding } from '@sendbird/uikit-utils'; import type Icon from '../../components/Icon'; import Modal from '../../components/Modal'; import useHeaderStyle from '../../styles/useHeaderStyle'; import DialogSheet from '../Dialog/DialogSheet'; type HeaderProps = { onClose: () => Promise }; export type BottomSheetItem = { sheetItems: { icon?: keyof typeof Icon.Assets; iconColor?: string; title: string; titleColor?: string; disabled?: boolean; onPress: () => void; }[]; HeaderComponent?: (props: HeaderProps) => ReactNode; }; type Props = { visible: boolean; onHide: () => Promise; onError?: (error: unknown) => void; onDismiss?: () => void; } & BottomSheetItem; const BottomSheet = ({ onDismiss, onHide, visible, sheetItems, HeaderComponent }: Props) => { const { statusBarTranslucent } = useHeaderStyle(); const { width } = useWindowDimensions(); const safeArea = useSafeAreaPadding(['bottom', 'left', 'right']); return ( {HeaderComponent && } {sheetItems.map(({ onPress, ...props }, idx) => ( { await onHide(); try { onPress(); } catch {} }} > ))} ); }; export default BottomSheet;