diff --git a/src/react/List.tsx b/src/react/List.tsx index 8ca33177c..f04acf595 100644 --- a/src/react/List.tsx +++ b/src/react/List.tsx @@ -205,6 +205,10 @@ export interface ListHandle { * Get current scrollHeight or scrollWidth. */ readonly scrollSize: number; + /** + * Get current offsetHeight or offsetWidth. + */ + readonly viewportSize: number; /** * Scroll to the item specified by index. * @param index index of item @@ -388,6 +392,9 @@ export const List = forwardRef( get scrollSize() { return scroller._getActualScrollSize(); }, + get viewportSize() { + return store._getViewportSize(); + }, scrollToIndex(index) { scroller._scrollToIndex(index, count); }, diff --git a/stories/advanced/InfiniteScrolling.stories.tsx b/stories/advanced/InfiniteScrolling.stories.tsx index 2db6df215..dc78368bc 100644 --- a/stories/advanced/InfiniteScrolling.stories.tsx +++ b/stories/advanced/InfiniteScrolling.stories.tsx @@ -130,7 +130,7 @@ export const InfiniteScrolling: StoryObj = { }} > {items.map((d) => ( - + ))} {/* Now hide spinner without unmounting because onRangeChange is called twice due to item length change */}