Releases: bamlab/react-tv-space-navigation
v5.1.0
5.1.0 (2024-10-15)
This is technically a breaking version, but only people that updated to 5.0.0 will be affected.
The new additionalItemsRendered
property was not correct. It was defaulting to 4, but the minimum value was 2, which was not clear at all.
We made 0 the new minimum value, and shifted values by 2.
New default value becomes 2 (equivalent to 4 previously).
If you customized this property, you can remove 2 to the value and it should be equivalent (except in the case of jump-on-scroll
behaviour).
⚠ BREAKING CHANGES
- lists: make additionally rendered items less error prone (#163)
Bug Fixes
v5.0.0
5.0.0 (2024-10-08)
⚠ BREAKING CHANGES
- VirtualizedList: remove numberOfElementsVisibleOnScreen and numberOfElementsRendered props (#153)
Features
- add onLongSelect prop to Node (7dfae9a)
- VirtualizedList: remove numberOfElementsVisibleOnScreen and numberOfElementsRendered props (#153) (2268059)
Migration guide (should be quick)
Switching to the new version
In the latest version, the numberOfItemsVisibleOnScreen
and numberOfItemsRendered
props have been removed from the virtualized lists and grid API. The numberOfItemsVisibleOnScreen
is now calculated automatically based on the parent view size.
Both of these props have been replaced by a new optional prop called additionalItemsRendered
. This prop controls the number of items rendered just outside the visible screen (but not yet virtualized). It allows you to fine-tune the virtualization size without the need to manually calculate numberOfItemsVisibleOnScreen
, which could lead to incorrect values.
<SpatialNavigationVirtualizedList
data={data}
renderItem={renderItem}
itemSize={itemSize}
- numberOfItemsVisibleOnScreen={5}
- numberOfItemsRendered={8}
+ additionalItemsRendered={3} // optional
/>
How to Update to the New Version
To migrate to the new version, you'll need to remove the numberOfItemsVisibleOnScreen
and numberOfItemsRendered
props from all instances of SpatialNavigationVirtualizedList
and SpatialNavigationVirtualizedGrid
.
By default, you don't need to provide a value for additionalItemsRendered
. However, if you want to replicate the behavior of the previous version exactly, you can set additionalItemsRendered
to numberOfItemsRendered - numberOfItemsVisibleOnScreen
. This will ensure the same number of off-screen items are rendered.
Impact on Tests
Your tests may also break, as the number of visible items is now calculated based on the size of the parent view. This number will vary depending on the execution environment. For example, in Jest, where the window width is 750 px, the calculation will be based on that width.
v4.0.1
v4.0.0
4.0.0 (2024-08-01)
⚠ BREAKING CHANGES
- scrollview: add CSS scroll on ScrollView (#146)
- This changed the ScrollView and its behaviour. You should try it, it should work better. If it causes any issue, you may use the new
useNativeScroll
flag on the scroll view.
- This changed the ScrollView and its behaviour. You should try it, it should work better. If it causes any issue, you may use the new