import React, { FC, PropsWithChildren } from 'react' import Modal from 'react-native-modal' import { useTheme } from '../theme/context/ThemeContext' import { useSafeAreaInsets } from 'react-native-safe-area-context' import { themed } from '../theme/themed' import { View } from 'react-native' import { StandardIconButton } from '../buttons/StandardIconButton' import { styled } from '@nbottarini/react-native-styled' import { rv } from '../rv' export const BottomSheet: FC = (props) => { const { ds, resolve } = useTheme() const insets = useSafeAreaInsets() // noinspection RequiredAttributes return ( {props.showClose && ()} {props.children} ) } const Container = themed(View, ({ ds, resolve }) => ({ maxHeight: '80%', paddingTop: rv(30), backgroundColor: resolve(ds.comp.bottomSheet.containerColor), borderTopLeftRadius: resolve(ds.comp.bottomSheet.containerShape), borderTopRightRadius: resolve(ds.comp.bottomSheet.containerShape), })) const CloseButton = styled(StandardIconButton, { top: rv(4), right: rv(4), position: 'absolute', }) const Content = themed(View, ({ ds, resolve }) => ({ flexShrink: 1, paddingHorizontal: resolve(ds.comp.bottomSheet.contentContainerPaddingHorizontal), paddingTop: resolve(ds.comp.bottomSheet.contentContainerPaddingTop), paddingBottom: resolve(ds.comp.bottomSheet.contentContainerPaddingBottom), })) export interface BottomSheetProps extends PropsWithChildren { onClose?: () => void showClose?: boolean }