import React from 'react'; import { Animated, StyleSheet, Modal, RefreshControl } from 'react-native'; import Body from './Body'; import Header from './Header'; import Footer from './Footer'; import Divider from './Divider'; import { Ripple } from '../Ripple'; import useTheme from '../../context/theme/useTheme'; import { Button } from '../Button'; import BaseComponent from './Base'; import { useCardProvider, CardProvider } from './Context'; import type { CardProps } from './types'; import { Box } from '../Box'; import createSxStyle, { getSxStyleAndProps } from '../../lib/sx'; import { ScrollView } from '../ScrollView'; import { CloseOutlineIcon } from '../../icons'; interface ComponentExport { Header: typeof Header; Divider: typeof Divider; Body: typeof Body; Footer: typeof Footer; } const CardRender: React.FC = React.memo( ({ children, expandContent, onPress, onClose, isExpandCard = Boolean(expandContent), isPressable = isExpandCard, Component = isPressable ? Ripple : Box, borderWidth = 1, borderColor = 'border', withBorder = !!borderColor, background = 'card', rippleProps = { disableRipple: true }, style = {}, sx, styles, ...restProps }) => { const theme = useTheme(); const { isOpen, toggle: toggleAction, onlyExpandContent } = useCardProvider(); const onInternalPress = React.useCallback( (event) => { if (isPressable && expandContent) { toggleAction(); } onPress && onPress(event); }, [expandContent, isPressable, onPress, toggleAction] ); const onInternalClose = React.useCallback( (event?: any) => { if (expandContent && isPressable) { toggleAction(); } onClose && onClose(event); }, [expandContent, isPressable, onClose, toggleAction] ); const resolveProps = getSxStyleAndProps( { borderStyle: 'solid', flexDirection: 'column', position: 'relative', sx: sx?.root, ...sx, ...restProps, style: [style, styles?.root] }, theme ); return ( <> {children} {/* ); } ); export const Card: React.FC & ComponentExport = ({ expandContent, onlyExpandContent, ...props }) => { return ( ); }; Card.Header = Header; Card.Body = Body; Card.Footer = Footer; Card.Divider = Divider;