Interface: VirtuosoMessageListMethods<Data, Context>
The imperative API of the message list component. You can access it with a ref
, or by using the `useVirtuosoMethods()` hook from a child component.
Type Parameters
• Data = any
The type of the data items in the list. Specifying this type gives you correct typing in the data
methods.
• Context = any
The type of the context passed to the list. Specifying this type gives you correct typing in the data
methods.
Properties
data
data:
DataMethods
<Data
,Context
>
A set of methods to manipulate the data in the list.
scrollToItem()
scrollToItem: (
location
) =>void
Scrolls the list to the specified item. See ItemLocation for possible location details. Passing a number scrolls to the item at the specified index aligned to the top.
Parameters
location
Returns
void
scrollIntoView()
scrollIntoView: (
location
) =>void
Scrolls the specified item into view if necessary. See ItemLocation for possible location details. Passing a number scrolls to the item at the specified index.
Parameters
location
Returns
void
scrollerElement()
scrollerElement: () =>
null
|HTMLDivElement
Lets you obtain a reference to the component's scroller DOM element.
Returns
null
| HTMLDivElement
getScrollLocation()
getScrollLocation: () =>
ListScrollLocation
Retrieves the current scroll location
Returns
cancelSmoothScroll()
cancelSmoothScroll: () =>
void
Cancels the current smooth scroll operation, if any.
Returns
void
height()
height: (
item
) =>number
Gets the known height of the item.
Parameters
item
Data
Returns
number