ui/VirtualList
Unstyled virtual list components and behaviors to be customized by a theme or application.
Members
Section titled “Members ”VirtualList Component
Section titled “VirtualList   Component ”An unstyled scrollable virtual list component with touch support.
Extends:
ui/VirtualListui/VirtualList.VirtualListBasic
Properties
cbScrollTo
Section titled “cbScrollTo”A callback function that receives a reference to the scrollTo feature.
Once received, the scrollTo method can be called as an imperative interface.
The scrollTo function accepts the following parameters:
{position: {x, y}} - Pixel value for x and/or y position
{align} - Where the scroll area should be aligned. Values are:
'left','right','top','bottom','topleft','topright','bottomleft', and'bottomright'.{index} - Index of specific item. (
0or positive integer) This option is available for onlyVirtualListkind.{node} - Node to scroll into view
{animate} - When
true, scroll occurs with animation. Whenfalse, no animation occurs.{focus} - When
true, attempts to focus item after scroll. Only valid when scrolling byindexornode.
Note: Only specify one of:
position,align,indexornode
Example:
// If you set cbScrollTo prop like below;
cbScrollTo: (fn) => {this.scrollTo = fn;}
// You can simply call like below;
this.scrollTo({align: 'top'}); // scroll to the topdirection
Section titled “direction”The layout direction of the list.
Valid values are:
'horizontal', and'vertical'.
horizontalScrollbar
Section titled “horizontalScrollbar”Specifies how to show horizontal scrollbar.
Valid values are:
'auto','visible', and'hidden'.
noScrollByWheel
Section titled “noScrollByWheel”Prevents scroll by wheeling on the list.
Default: falseonScroll
Section titled “onScroll”Called when scrolling.
Passes scrollLeft, scrollTop, and moreInfo.
It is not recommended to set this prop since it can cause performance degradation.
Use onScrollStart or onScrollStop instead.
onScrollStart
Section titled “onScrollStart”Called when scroll starts.
Passes scrollLeft, scrollTop, and moreInfo.
You can get firstVisibleIndex and lastVisibleIndex from VirtualList with moreInfo.
Example:
onScrollStart = ({scrollLeft, scrollTop, moreInfo}) => {
const {firstVisibleIndex, lastVisibleIndex} = moreInfo;
// do something with firstVisibleIndex and lastVisibleIndex
}
render = () => (
<VirtualList
...
onScrollStart={this.onScrollStart}
...
/>
)onScrollStop
Section titled “onScrollStop”Called when scroll stops.
Passes scrollLeft, scrollTop, and moreInfo.
You can get firstVisibleIndex and lastVisibleIndex from VirtualList with moreInfo.
Example:
onScrollStop = ({scrollLeft, scrollTop, moreInfo}) => {
const {firstVisibleIndex, lastVisibleIndex} = moreInfo;
// do something with firstVisibleIndex and lastVisibleIndex
}
render = () => (
<VirtualList
...
onScrollStop={this.onScrollStop}
...
/>
)The ARIA role for the list.
Default: 'list'scrollMode
Section titled “scrollMode”Specifies how to scroll.
Valid values are:
'translate','native'.
verticalScrollbar
Section titled “verticalScrollbar”Specifies how to show vertical scrollbar.
Valid values are:
'auto','visible', and'hidden'.
VirtualGridList Component
Section titled “VirtualGridList   Component ”An unstyled scrollable virtual grid list component with touch support.
Extends:
ui/VirtualListui/VirtualList.VirtualListBasic
Properties
cbScrollTo
Section titled “cbScrollTo”A callback function that receives a reference to the scrollTo feature.
Once received, the scrollTo method can be called as an imperative interface.
The scrollTo function accepts the following parameters:
{position: {x, y}} - Pixel value for x and/or y position
{align} - Where the scroll area should be aligned. Values are:
'left','right','top','bottom','topleft','topright','bottomleft', and'bottomright'.{index} - Index of specific item. (
0or positive integer) This option is available for onlyVirtualListkind.{node} - Node to scroll into view
{animate} - When
true, scroll occurs with animation. Whenfalse, no animation occurs.{focus} - When
true, attempts to focus item after scroll. Only valid when scrolling byindexornode.
Note: Only specify one of:
position,align,indexornode
Example:
// If you set cbScrollTo prop like below;
cbScrollTo: (fn) => {this.scrollTo = fn;}
// You can simply call like below;
this.scrollTo({align: 'top'}); // scroll to the topdirection
Section titled “direction”The layout direction of the list.
Valid values are:
'horizontal', and'vertical'.
horizontalScrollbar
Section titled “horizontalScrollbar”Specifies how to show horizontal scrollbar.
Valid values are:
'auto','visible', and'hidden'.
noScrollByWheel
Section titled “noScrollByWheel”Prevents scroll by wheeling on the list.
Default: falseonScroll
Section titled “onScroll”Called when scrolling.
Passes scrollLeft, scrollTop, and moreInfo.
It is not recommended to set this prop since it can cause performance degradation.
Use onScrollStart or onScrollStop instead.
onScrollStart
Section titled “onScrollStart”Called when scroll starts.
Passes scrollLeft, scrollTop, and moreInfo.
You can get firstVisibleIndex and lastVisibleIndex from VirtualGridList with moreInfo.
Example:
onScrollStart = ({scrollLeft, scrollTop, moreInfo}) => {
const {firstVisibleIndex, lastVisibleIndex} = moreInfo;
// do something with firstVisibleIndex and lastVisibleIndex
}
render = () => (
<VirtualGridList
...
onScrollStart={this.onScrollStart}
...
/>
)onScrollStop
Section titled “onScrollStop”Called when scroll stops.
Passes scrollLeft, scrollTop, and moreInfo.
You can get firstVisibleIndex and lastVisibleIndex from VirtualList with moreInfo.
Example:
onScrollStop = ({scrollLeft, scrollTop, moreInfo}) => {
const {firstVisibleIndex, lastVisibleIndex} = moreInfo;
// do something with firstVisibleIndex and lastVisibleIndex
}
render = () => (
<VirtualGridList
...
onScrollStop={this.onScrollStop}
...
/>
)The ARIA role for the list.
Default: 'list'scrollMode
Section titled “scrollMode”Specifies how to scroll.
Valid values are:
'translate','native'.
verticalScrollbar
Section titled “verticalScrollbar”Specifies how to show vertical scrollbar.
Valid values are:
'auto','visible', and'hidden'.
VirtualListBasic Component
Section titled “VirtualListBasic   Component ”A basic base component for ui/VirtualListui/VirtualList.VirtualList and ui/VirtualListui/VirtualList.VirtualGridList.
Properties
Required Property • itemRenderer
Section titled “Required Property • itemRenderer”The rendering function called for each item in the list.
Note: The list does not always render a component whenever its render function is called due to performance optimization.
Example:
renderItem = ({index, ...rest}) => {
return (
<MyComponent index={index} {...rest} />
);
}childProps
Section titled “childProps”Additional props included in the object passed to the itemRenderer callback.
clientSize
Section titled “clientSize”Client size of the list; valid values are an object that has clientWidth and clientHeight.
dataSize
Section titled “dataSize”The number of items of data the list contains.
Default: 0direction
Section titled “direction”The layout direction of the list.
Valid values are:
'horizontal', and'vertical'.
The ARIA role for the list.
Default: 'list'scrollMode
Section titled “scrollMode”Specifies how to scroll.
Valid values are:
'translate','native'.
spacing
Section titled “spacing”The spacing between items.
Default: 0Type Definitions
Section titled “Type Definitions ”gridListItemSizeShape Object
Section titled “gridListItemSizeShape   Object ”The shape for the grid list item size in a list for ui/VirtualListui/VirtualList.VirtualGridList.
The minimum width of the grid list item.
The minimum height of the grid list item.
itemSizesShape Object
Section titled “itemSizesShape   Object ”The shape for the list different item size in a list for ui/VirtualListui/VirtualList.VirtualList.
The minimum size of the list item.
An array of the list item size. If it is not defined, the list items will render with the minSize size.