Made with the awesome create-react-library
This library comes to partly solve the case of rendering dynamically sized items with react-window, for more information about the issue please read this thread. Before you overjoy please read the limitations of this approach down bellow 😪
npm install --save react-window-dynamic-list
Yep. its that simple 😆
The API is the same as VariableSizeList with some small changes and additions.
itemCountyou must pass
estimatedItemSizefor you 😎
|data||✓||All of the data that will be displayed in the list. |
|cache||✓||The cache object which the list will use for caching the calculated sizes.|
Check the example for how to create it.
|lazyMeasurement||Whether the application should fill the cache in the background.|
Please note: After each cache clear the application will restart the lazy cache filling (For example after adding or removing an item)
For more information read the caching section.
|recalculateItemsOnResize||Whether the list should recalculate the items size if its own size has changed. This value should not change from its initial one.|
Currently the feature is supported but far from perfect, therefore it is disabled by default.
|measurementContainerElement||A custom container element in which the elements will be rendered for measuring. Especially useful for changing the scrollbar width. |
You must pass the
|debug||Whether the measurement layer should be visible, useful for debugging a custom |
Just in time measurement with caching in the background.
The algorithm is divided into two main concepts:
We measure each item in the list by temporary rendering it with
react-dom in a different application.
For more information please read this great article.
In order for just in time measurements to be effective we need to cache the measurements. Currently there are two caching modes:
Your data doesn't change its size.
Currently only supports vertical layout. (didn't have time to implement support for horizontal).
All of the styling regarding the items must be
inline or not affected by location in the
Changes to the list's scrollbar, especially the width, should also effect the measurement container div. Since we pre render the items in order to measure them the size of the scrollbar is important in the pre rendered item as well. This can be achieved in the following ways:
MIT © gnir-work