Repository navigation
Fix VirtualView clipping with stale parent offset on Android - #59421
Open
christophpurrer wants to merge 1 commit into
Open
christophpurrer wants to merge 1 commit into
christophpurrer wants to merge 1 commit into
Conversation
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
|
@christophpurrer has exported this pull request. If you are a Meta employee, you can view the originating Diff in D126932544. |
Visual regression1 visual difference(s) at ios: no capture android
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



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),ReactVirtualViewcells 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 callsupdateParentOffset(). Fabric attaches a view before laying it out, and ancestors that are already laid out don't fireonLayoutChangeagain, so the offset used to stay 0 and the clipping rect was shifted.recycleView()now resetsoffsetX/offsetYso a recycled view doesn't keep the previous parent's offset. Reporting toVirtualViewContainerstill 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