Skip to content

Releases: theRizwan/react-native-virtual-list

v0.1.1 web prepend fix

Choose a tag to compare

@theRizwan theRizwan released this 19 Aug 12:18

Fixes web prepending, which was broken in 0.1.0.

If you are using this on react-native-web, upgrade. In 0.1.0 the layout maths was correct but the component never wrote the corrected offset back to the scroll view, so inserting older items at the top jumped the list by the full height of the inserted content. On native the platform hides this because maintainVisibleContentPosition does the correction itself. On react-native-web nothing does, and react-native-web does not implement that prop at all.

  • The correction is now applied on web only, since doing it on both platforms would compensate twice
  • clone() carries the reordering flag, because a clone inherits the chunk order and hung the same way
  • The package now ships compiled output, so bundlers that only treat .jsx as JSX can build it. 0.1.0 shipped JSX inside .js files and failed under Vite

Verified in a browser: 1000 rows of varying height with a deliberately wrong estimate, scrolled into the middle, then prepended 200 rows four times to 2000. A probe read the real getBoundingClientRect().top of a tracked row before and after each prepend. Every round the scroll position was adjusted by exactly the amount the content grew and the tracked row held position to the pixel.

v0.1.0

Choose a tag to compare

@theRizwan theRizwan released this 19 Aug 12:18

First release.

A virtualized list for React Native and react-native-web that keeps its scroll position when item heights are only known after they render.

  • Item offsets come from a Fenwick tree rather than a materialised position array, so they are non decreasing by construction and the visible range search cannot be misled by a partially corrected table
  • Position is stored as an anchor, meaning an item plus how far its top sits above the viewport, rather than as a scroll offset
  • scrollToIndex lands on the requested row even when nothing has been measured
  • 56 automated tests, no device required: 43 unit tests including differential fuzzing against a naive implementation and a run at one million items, plus 13 render tests driving the real component through react-test-renderer

Tested on a physical iOS device.