Skip to content

Commit 63b3b39

Browse files
committed
fix: render list not correct in onVisibleChange
1 parent 2b3d36c commit 63b3b39

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/List.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -303,9 +303,11 @@ export function RawList<T>(props: ListProps<T>, ref: React.Ref<ListRef>) {
303303
// ================================ Effect ================================
304304
/** We need told outside that some list not rendered */
305305
useLayoutEffect(() => {
306-
const renderList = mergedData.slice(start, end);
306+
if (onVisibleChange) {
307+
const renderList = mergedData.slice(start, end + 1);
307308

308-
onVisibleChange?.(renderList, mergedData);
309+
onVisibleChange(renderList, mergedData);
310+
}
309311
}, [start, end, mergedData]);
310312

311313
// ================================ Render ================================

0 commit comments

Comments
 (0)