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
Name | Type | Description |
---|---|---|
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
: ItemLocation
) => 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.
Type declaration
▸ (location
): void
Parameters
Name | Type |
---|---|
location | ItemLocation |
Returns
void
scrollIntoView
• scrollIntoView: (location
: ItemLocation
) => 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.
Type declaration
▸ (location
): void
Parameters
Name | Type |
---|---|
location | ItemLocation |
Returns
void
scrollerElement
• scrollerElement: () => HTMLDivElement
Lets you obtain a reference to the component's scroller DOM element.
Type declaration
▸ (): HTMLDivElement
Returns
HTMLDivElement
getScrollLocation
• getScrollLocation: () => ListScrollLocation
Retrieves the current scroll location
Type declaration
▸ (): ListScrollLocation
Returns
cancelSmoothScroll
• cancelSmoothScroll: () => void
Cancels the current smooth scroll operation, if any.
Type declaration
▸ (): void
Returns
void