import {memo, useState} from 'react'; import {Pressable, Text, View} from 'react-native'; import {renderIcon} from '../../helpers/renderIcon'; import {drawerStyles} from '../../theme'; import type {DrawerGroupProps, IconProps} from '../../types'; import {ChevronGlyph} from '../glyphs/Glyphs'; import {DrawerItem} from './DrawerItem'; const CollapseGlyph = (props: IconProps) => ( ); const ExpandGlyph = (props: IconProps) => ( ); const DrawerGroupComponent = ({ collapseIcon = CollapseGlyph, expandIcon = ExpandGlyph, fontSize, handleDrawer, iconSize, item, textColor, }: DrawerGroupProps) => { const [visible, setVisible] = useState(false); return ( setVisible(!visible)}> {renderIcon(item.icon, {size: iconSize, color: textColor})} {item.text} {renderIcon(visible ? collapseIcon : expandIcon, { size: iconSize, color: textColor, })} {visible && item.items.map((child, idx) => ( ))} ); }; export const DrawerGroup = memo(DrawerGroupComponent);