Scroll Location
AutoscrollToBottom
Section titled “AutoscrollToBottom”AutoscrollToBottom<
Data,Context> =ItemLocationCallback<Data,Context> |NonNullable<ScrollToOptions["behavior"]> |boolean
Specifies the list behavior to perform when the list data changes.
Type Parameters
Section titled “Type Parameters”| Type Parameter | Default type | Description |
|---|---|---|
Data | unknown | The type of the data items in the list. |
Context | unknown | The type of the context passed to the list. |
ItemLocation
Section titled “ItemLocation”ItemLocation =
number|ItemLocationWithAlign
A location in the list to scroll to. Passing a number scrolls instantly to the item at the specified index aligned to the top. See ItemLocationWithAlign for more advanced options.
ItemLocationCallback
Section titled “ItemLocationCallback”ItemLocationCallback<
Data,Context> = (params) =>ScrollBehavior|boolean|ItemLocation
A callback function that determines the scroll behavior when data changes.
Type Parameters
Section titled “Type Parameters”| Type Parameter | Default type | Description |
|---|---|---|
Data | unknown | The type of the data items in the list. |
Context | unknown | The type of the context passed to the list. |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
params | ItemLocationCallbackParams<Data, Context> |
Returns
Section titled “Returns”ScrollBehavior | boolean | ItemLocation
ItemLocationCallbackParams
Section titled “ItemLocationCallbackParams”The parameters passed to the ItemLocationCallback function.
Type Parameters
Section titled “Type Parameters”| Type Parameter | Default type | Description |
|---|---|---|
Data | unknown | The type of the data items in the list. |
Context | unknown | The type of the context passed to the list. |
Properties
Section titled “Properties”atBottom
Section titled “atBottom”boolean
Whether the list is at the bottom before the data change.
context
Section titled “context”Context
The context passed to the list.
Data[]
The new data that will be appended to the list.
scrollInProgress
Section titled “scrollInProgress”boolean
Indicates whether the list is currently scrolling. If you receive fast updates and use 'smooth' scrolling, there’s a chance that the list will be in the middle of a scroll when new data arrives.
scrollLocation
Section titled “scrollLocation”The location of the list before the data change. See ListScrollLocation for the details of the parameter received.
ItemLocationWithAlign
Section titled “ItemLocationWithAlign”Specifies a location in the list to scroll to.
Properties
Section titled “Properties”align?: "start" | "center" | "end" | "start-no-overflow"
Section titled “align?: "start" | "center" | "end" | "start-no-overflow"”How to align the item in the viewport.
Set 'smooth' to have an animated transition to the specified location.
done()?
Section titled “done()?”
optionaldone: () =>void
A callback that’s invoked when the scroll is complete.
Returns
Section titled “Returns”void
number | "LAST"
The index of the item to scroll to. Use 'LAST' to scroll to the last item.
offset?: number
Section titled “offset?: number”Use the offset for additional adjustment of the position - can be a positive or negative number.
ScrollModifier
Section titled “ScrollModifier”ScrollModifier =
null|undefined| {location:ItemLocation;purgeItemSizes?:boolean;type:"item-location"; } | {autoScroll:AutoscrollToBottom;type:"auto-scroll-to-bottom"; } | {behavior:ScrollBehavior| {location: () =>ItemLocation|null|undefined; };type:"items-change"; } |ScrollModifierOptionValue
Describes the scroll modification to perform when the data of the list is updated. See the scroll modifier documentation section for examples of how to use this type.
ScrollModifierOption
Section titled “ScrollModifierOption”
constScrollModifierOption:object
Predefined scroll modifier options for common data operations.
Type Declaration
Section titled “Type Declaration”prepend
Section titled “prepend”"prepend"
removeFromEnd
Section titled “removeFromEnd”"remove-from-end"
removeFromStart
Section titled “removeFromStart”"remove-from-start"
ScrollModifierOptionType
Section titled “ScrollModifierOptionType”ScrollModifierOptionType = typeof
ScrollModifierOption
The type of the ScrollModifierOption constant.
ScrollModifierOptionValue
Section titled “ScrollModifierOptionValue”ScrollModifierOptionValue =
ScrollModifierOptionType[keyofScrollModifierOptionType]
The possible values of the ScrollModifierOption constant.
ShortSizeAlign
Section titled “ShortSizeAlign”ShortSizeAlign =
"top"|"bottom"|"bottom-smooth"
Specifies the alignment of the items when the content of the list is smaller than the viewport height.
'top'(default), the items will be aligned to the top'bottom', the items will be aligned to the bottom.'bottom-smooth', the items will be aligned to the bottom and the scroll will be animated.