Skip to content

Commit 38704aa

Browse files
committed
feat: Add onVisibleChange
1 parent 26dae8e commit 38704aa

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Overflow.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ export interface OverflowProps<ItemType> extends React.HTMLAttributes<any> {
5050
suffix?: React.ReactNode;
5151
component?: ComponentType;
5252
itemComponent?: ComponentType;
53+
54+
/** @private This API may be refactor since not well design */
55+
onVisibleChange?: (visibleCount: number) => void;
5356
}
5457

5558
function defaultRenderRest<ItemType>(omittedItems: ItemType[]) {
@@ -75,6 +78,7 @@ function Overflow<ItemType = any>(
7578
suffix,
7679
component: Component = 'div',
7780
itemComponent,
81+
onVisibleChange,
7882
...restProps
7983
} = props;
8084

@@ -147,6 +151,8 @@ function Overflow<ItemType = any>(
147151
setDisplayCount(count);
148152
if (!notReady) {
149153
setRestReady(count < data.length - 1);
154+
155+
onVisibleChange?.(count);
150156
}
151157
}
152158

0 commit comments

Comments
 (0)