Files
react-native/packages/virtualized-lists
Fabrizio Duroni c0bf1549c2 Re-enabled VirtualizedList "retains batch render region when an item is appended" test (#56653)
Summary:
This PR is a follow-up of https://github.com/facebook/react-native/issues/56358, in order to improve and VirtualizedList tests.
I re-enabled the skipped test `retains batch render region when an item is appended`.
With React 19, the previous approach that was using `jest.runAllTimersAsync` in this test path was unstable because the pre-update render region could still be processing updates.
I adopted the same approach used in https://github.com/facebook/react-native/issues/56358 by introducing a small helper function, `advanceUntilLastCellIndexRendered`, which advances timers one step at a time and stops when the expected state is reached: `cellsAroundViewport.last === items.length - 1`.

As part of this follow-up, I also aligned `advanceUntilRenderAreaChanged` to use performNextBatch for consistent stepwise timer advancement.

## Changelog:

[GENERAL][FIXED] - Re-enabled VirtualizedList "retains batch render region when an item is appended" tes

Pull Request resolved: https://github.com/facebook/react-native/pull/56653

Test Plan:
- Ran the VirtualizedList-test.js and verified all test cases passed.
- Verified test modification correctness by intentionally breaking the related snapshot and check that it is breaking/it is failing.

Reviewed By: cortinico

Differential Revision: D104291284

Pulled By: Abbondanzo

fbshipit-source-id: e32f8707a837a1805ce130d526768228f684e3e7
2026-05-08 09:56:47 -07:00
..

@react-native/virtualized-lists

Version

Installation

yarn add @react-native/virtualized-lists

Note: We're using yarn to install deps. Feel free to change commands to use npm 3+ and npx if you like

Testing

To run the tests in this package, run the following commands from the React Native root folder:

  1. yarn to install the dependencies. You just need to run this once
  2. yarn jest packages/virtualized-lists.