Commit 348c9ea
authored
fix(scroll): read initialScrollIndex offset after layout recompute (#2133)
* fix(scroll): read initialScrollIndex offset after layout recompute
In applyInitialScrollAdjustment(), the scroll offset for the target
initialScrollIndex item was read before recomputeLayouts() ran. The
recompute re-estimates unmeasured items with updated average heights,
which shifts the target item's y position. The stale offset caused a
mismatch between the EngagedIndicesTracker's scroll position and the
actual item positions, resulting in blank screens or overlapping items
when initialScrollIndex was set with variable-height items.
Move the offset read to after recomputeLayouts() so the scroll offset
always reflects the target item's actual position. Also fixes a minor
operator precedence issue in the nullish coalescing fallback.
Includes a fixture repro screen (OverlapRepro) with 200 variable-height
items (40-500px) and initialScrollIndex=50.
Fixes #1797
* Remove OverlapRepro sample screen1 parent e81f4ef commit 348c9ea
1 file changed
+15
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
382 | 382 | | |
383 | 383 | | |
384 | 384 | | |
385 | | - | |
386 | | - | |
387 | | - | |
388 | | - | |
389 | | - | |
390 | | - | |
391 | 385 | | |
392 | 386 | | |
393 | | - | |
394 | | - | |
395 | | - | |
396 | | - | |
397 | | - | |
398 | | - | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
399 | 391 | | |
400 | | - | |
401 | | - | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
402 | 398 | | |
403 | | - | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
404 | 403 | | |
405 | | - | |
| 404 | + | |
406 | 405 | | |
407 | 406 | | |
408 | 407 | | |
| |||
0 commit comments