Skip to content

Latest commit

 

History

History
158 lines (81 loc) · 4.38 KB

File metadata and controls

158 lines (81 loc) · 4.38 KB

API


Interface: WindowVirtualizerProps<T>

Defined in: src/solid/WindowVirtualizer.tsx:58

Props of WindowVirtualizer.

Type Parameters

T

T

Properties

ref()?

optional ref: (handle?) => void

Defined in: src/solid/WindowVirtualizer.tsx:62

Get reference to WindowVirtualizerHandle.

Parameters

handle?

WindowVirtualizerHandle

Returns

void


data

data: readonly T[]

Defined in: src/solid/WindowVirtualizer.tsx:66

The data items rendered by this component.


children()

children: (data, index) => Element

Defined in: src/solid/WindowVirtualizer.tsx:70

The elements renderer function.

Parameters

data

T

index

Accessor<number>

Returns

Element


overscan?

optional overscan: number

Defined in: src/solid/WindowVirtualizer.tsx:75

Number of items to render above/below the visible bounds of the list. Lower value will give better performance but you can increase to avoid showing blank items in fast scrolling.

Default Value

4

itemSize?

optional itemSize: number

Defined in: src/solid/WindowVirtualizer.tsx:82

Item size hint for unmeasured items. It will help to reduce scroll jump when items are measured if used properly.

  • If not set, initial item sizes will be automatically estimated from measured sizes. This is recommended for most cases.
  • If set, you can opt out estimation and use the value as initial item size.

shift?

optional shift: boolean

Defined in: src/solid/WindowVirtualizer.tsx:86

While true is set, scroll position will be maintained from the end not usual start when items are added to/removed from start. It's recommended to set false if you add to/remove from mid/end of the list because it can cause unexpected behavior. This prop is useful for reverse infinite scrolling.


horizontal?

optional horizontal: boolean

Defined in: src/solid/WindowVirtualizer.tsx:90

If true, rendered as a horizontally scrollable list. Otherwise rendered as a vertically scrollable list.


cache?

optional cache: CacheSnapshot

Defined in: src/solid/WindowVirtualizer.tsx:96

You can restore cache by passing a CacheSnapshot on mount. This is useful when you want to restore scroll position after navigation. The snapshot can be obtained from WindowVirtualizerHandle.cache.

The length of items should be the same as when you take the snapshot, otherwise restoration may not work as expected.


onScroll()?

optional onScroll: () => void

Defined in: src/solid/WindowVirtualizer.tsx:100

Callback invoked whenever scroll offset changes.

Returns

void


onScrollEnd()?

optional onScrollEnd: () => void

Defined in: src/solid/WindowVirtualizer.tsx:104

Callback invoked when scrolling stops.

Returns

void