Skip to content

Scroll Location

AutoscrollToBottom<Data, Context> = ItemLocationCallback<Data, Context> | NonNullable<ScrollToOptions["behavior"]> | boolean

Specifies the list behavior to perform when the list data changes.

Type ParameterDefault typeDescription
DataunknownThe type of the data items in the list.
ContextunknownThe type of the context passed to the list.

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<Data, Context> = (params) => ScrollBehavior | boolean | ItemLocation

A callback function that determines the scroll behavior when data changes.

Type ParameterDefault typeDescription
DataunknownThe type of the data items in the list.
ContextunknownThe type of the context passed to the list.
ParameterType
paramsItemLocationCallbackParams<Data, Context>

ScrollBehavior | boolean | ItemLocation


The parameters passed to the ItemLocationCallback function.

Type ParameterDefault typeDescription
DataunknownThe type of the data items in the list.
ContextunknownThe type of the context passed to the list.

boolean

Whether the list is at the bottom before the data change.


Context

The context passed to the list.


Data[]

The new data that will be appended to the list.


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.


ListScrollLocation

The location of the list before the data change. See ListScrollLocation for the details of the parameter received.


Specifies a location in the list to scroll to.

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.


optional done: () => void

A callback that’s invoked when the scroll is complete.

void


number | "LAST"

The index of the item to scroll to. Use 'LAST' to scroll to the last item.


Use the offset for additional adjustment of the position - can be a positive or negative number.


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.


const ScrollModifierOption: object

Predefined scroll modifier options for common data operations.

"prepend"

"remove-from-end"

"remove-from-start"


ScrollModifierOptionType = typeof ScrollModifierOption

The type of the ScrollModifierOption constant.


ScrollModifierOptionValue = ScrollModifierOptionType[keyof ScrollModifierOptionType]

The possible values of the ScrollModifierOption constant.


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.