Skip to content

Commit d5a7618

Browse files
authored
Force at least one item to always be initially rendered (#5029)
1 parent 497aacf commit d5a7618

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/lib/hooks/useInitialNumToRender.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,10 @@ export function useInitialNumToRender({
1515

1616
const finalHeight =
1717
screenHeight - screenHeightOffset - topInset - bottomBarHeight
18-
return Math.floor(finalHeight / minItemHeight) + 1
18+
19+
const minItems = Math.floor(finalHeight / minItemHeight)
20+
if (minItems < 1) {
21+
return 1
22+
}
23+
return minItems
1924
}

0 commit comments

Comments
 (0)