Skip to content

Fix VirtualView clipping with stale parent offset on Android - #59421

Open
christophpurrer wants to merge 1 commit into
react:mainfrom
christophpurrer:export-D126932544
Open

christophpurrer wants to merge 1 commit into
react:mainfrom
christophpurrer:export-D126932544

Conversation

@christophpurrer

Copy link
Copy Markdown
Contributor

Summary:
WARNING: Generated by Autopilot (alpha) — review carefully, verify the underlying claim before accepting.
Agent: Bugs Agent v2 | Trajectory: https://www.internalfb.com/intern/devai/devmate/inspector/d6265d61-c8d9-4d75-abd2-f8c07ba525d7/ | 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

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) | Trajectory: https://www.internalfb.com/intern/devai/devmate/inspector/d6265d61-c8d9-4d75-abd2-f8c07ba525d7/ | 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
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 23, 2026
@meta-codesync

meta-codesync Bot commented Oct 23, 2026

Copy link
Copy Markdown

@christophpurrer has exported this pull request. If you are a Meta employee, you can view the originating Diff in D126932544.

@github-actions

Copy link
Copy Markdown

Visual regression

1 visual difference(s) at 02895c2511ab. Visual differences need maintainer approval. Review the report, then apply visual-change-approved.

ios: no capture

android transform/string/default: Changed, 1 px (0.000%)

diff

Expected and Captured
Expected Captured
expected captured

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant