You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| width | Number or String*| ✓ | Width of List. This property will determine the number of rendered items when scrollDirection is `'horizontal'`. |
75
-
| height | Number or String*| ✓ | Height of List. This property will determine the number of rendered items when scrollDirection is `'vertical'`. |
76
-
| itemCount | Number | ✓ | The number of items you want to render |
77
-
| renderItem | Function | ✓ | Responsible for rendering an item given it's index: `({index: number, style: Object}): React.PropTypes.node`. The returned element must handle key and style. |
78
-
| itemSize || ✓ | Either a fixed height/width (depending on the scrollDirection), an array containing the heights of all the items in your list, or a function that returns the height of an item given its index: `(index: number): number`|
79
-
| scrollDirection | String || Whether the list should scroll vertically or horizontally. One of `'vertical'` or `'horizontal'`. Defaults to `'vertical'`|
80
-
| scrollOffset | Number || Can be used to control the scroll offset; Also useful for setting an initial scroll offset |
81
-
| scrollToIndex | Number || Item index to scroll to (by forcefully scrolling if necessary) |
82
-
| scrollToAlignment ||| Used in combination with `scrollToIndex`, this prop controls the alignment of the scrolled to item. One of: 'start', 'center' or 'end' |
83
-
| overscanCount | Number || Number of extra buffer items to render above/below the visible items. Tweaking this can help reduce scroll flickering on certain browsers/devices. |
84
-
| estimatedItemSize | Number || Used to estimate the total size of the list before all of its items have actually been measured. The estimated total height is progressively adjusted as items are rendered. |
85
-
| onScroll | Function || Called on scroll events: `(scrollTop: number, event)`. |
| width | Number or String*| ✓ | Width of List. This property will determine the number of rendered items when scrollDirection is `'horizontal'`. |
75
+
| height | Number or String*| ✓ | Height of List. This property will determine the number of rendered items when scrollDirection is `'vertical'`. |
76
+
| itemCount | Number | ✓ | The number of items you want to render |
77
+
| renderItem | Function | ✓ | Responsible for rendering an item given it's index: `({index: number, style: Object}): React.PropTypes.node`. The returned element must handle key and style. |
78
+
| itemSize || ✓ | Either a fixed height/width (depending on the scrollDirection), an array containing the heights of all the items in your list, or a function that returns the height of an item given its index: `(index: number): number`|
79
+
| scrollDirection | String || Whether the list should scroll vertically or horizontally. One of `'vertical'` (default) or `'horizontal'`. |
80
+
| scrollOffset | Number || Can be used to control the scroll offset; Also useful for setting an initial scroll offset |
81
+
| scrollToIndex | Number || Item index to scroll to (by forcefully scrolling if necessary) |
82
+
| scrollToAlignment | String || Used in combination with `scrollToIndex`, this prop controls the alignment of the scrolled to item. One of: `'start'`, `'center'`, `'end'` or `'auto'`. Use `'start'` to always align items to the top of the container and `'end'` to align them bottom. Use `'center`' to align them in the middle of the container. 'auto'` scrolls the least amount possible to ensure that the specified `scrollToIndex` item is fully visible. |
83
+
| overscanCount | Number || Number of extra buffer items to render above/below the visible items. Tweaking this can help reduce scroll flickering on certain browsers/devices. |
84
+
| estimatedItemSize | Number || Used to estimate the total size of the list before all of its items have actually been measured. The estimated total height is progressively adjusted as items are rendered. |
85
+
| onRowsRendered | Function || Callback invoked with information about the slice of rows that were just rendered. It has the following signature: `({startIndex: number, stopIndex: number})`. |
86
+
| onScroll | Function || Callback invoked whenever the scroll offset changes within the inner scrollable region. It has the following signature: `(scrollTop: number, event: React.UIEvent<HTMLDivElement>)`. |
86
87
87
88
*\* Width may only be a string when `scrollDirection` is `'vertical'`. Similarly, Height may only be a string if `scrollDirection` is `'horizontal'`*
88
89
89
90
### Public Methods
90
91
91
92
#### recomputeSizes (index: number)
92
-
This method force recomputes the item sizes after the specificed index (these are normally cached).
93
+
This method force recomputes the item sizes after the specified index (these are normally cached).
93
94
94
95
`VirtualList` has no way of knowing when its underlying data has changed, since it only receives a itemSize property. If the itemSize is a `number`, this isn't an issue, as it can compare before and after values and automatically call `recomputeSizes` internally.
95
96
However, if you're passing a function to `itemSize`, that type of comparison is error prone. In that event, you'll need to call `recomputeSizes` manually to inform the `VirtualList` that the size of its items has changed.
0 commit comments