Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/hooks/useItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const convertItemsToNodes = (items: ItemType[], props: Props) => {
const {
children,
label,
wrapper,
key: rawKey,
collapsible: rawCollapsible,
onItemClick: rawOnItemClick,
Expand All @@ -50,7 +51,7 @@ const convertItemsToNodes = (items: ItemType[], props: Props) => {
isActive = activeKey.indexOf(key) > -1;
}

return (
const collapsePanel = (
<CollapsePanel
{...restProps}
prefixCls={prefixCls}
Expand All @@ -68,6 +69,12 @@ const convertItemsToNodes = (items: ItemType[], props: Props) => {
{children}
</CollapsePanel>
);

if (wrapper) {
return wrapper(collapsePanel);
}

return collapsePanel;
});
};

Expand Down
2 changes: 2 additions & 0 deletions src/interface.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { CSSMotionProps } from 'rc-motion';
import type * as React from 'react';
import type { ReactNode } from 'react';

export type CollapsibleType = 'header' | 'icon' | 'disabled';

Expand All @@ -16,6 +17,7 @@ export interface ItemType
> {
key?: CollapsePanelProps['panelKey'];
label?: CollapsePanelProps['header'];
wrapper?: ReactNode;
ref?: React.RefObject<HTMLDivElement>;
}

Expand Down