Repository navigation
Commit f9340f0
Fix VirtualView clipping with stale parent offset on Android
Summary:
WARNING: Generated by Autopilot (alpha) — review carefully, verify the underlying claim before accepting.
Agent: [Bugs Agent v2](https://www.internalfb.com/autopilot/marketplace?agent=1525997276001839) | SC job: https://www.internalfb.com/intern/sandcastle/instance/4503602683697923/
---
**Problem:** With subview clipping on (`rn_fling.support_subview_clipping`), `ReactVirtualView` cells that are inside the scroll viewport can lose their children and render blank until the user scrolls again. On the FB4A Marketplace home feed the "Newly listed" module showed only its header pill with an empty body (T294050483).
**Reproduction:** Fling the Marketplace Explore feed with clipping on. On master, 13–17 of 48 settled scroll states left the top on-screen row blank whenever up to 128 px of it, the list column's offset within the scroll content, was visible.
**Fix:** `doAttachedToWindow()` now always calls `updateParentOffset()`. Fabric attaches a view before laying it out, and ancestors that are already laid out don't fire `onLayoutChange` again, so the offset used to stay 0 and the clipping rect was shifted. `recycleView()` now resets `offsetX`/`offsetY` so a recycled view doesn't keep the previous parent's offset. Reporting to `VirtualViewContainer` still waits for the first layout.
**Caveat:** The production "Newly listed" module never rendered for the test user because it depends on local inventory and server gating, so the mechanism was verified on other feed cells and on a mocked module. A view that is detached and reattached without a new layout still isn't re-registered with the container until its next layout.
Changelog: [Android][Fixed] - Fix VirtualView clipping on-screen content when its parent offset was not computed at attach time
Reviewed By: christophpurrer
Differential Revision: D126932544
fbshipit-source-id: dce0b1d0cb0bbbb1da162126082f55989284e9041 parent da42db9 commit f9340f0
1 file changed
Lines changed: 2 additions & 0 deletions
File tree
- packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/virtual/view
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
| 55 | + | |
54 | 56 | | |
55 | 57 | | |
56 | 58 | | |
| |||
0 commit comments