Skip to content

Fix PixelCopy snapshot for partially off-screen views (#56608)#56608

Closed
zeyap wants to merge 1 commit into
react:mainfrom
zeyap:export-D102360642
Closed

Fix PixelCopy snapshot for partially off-screen views (#56608)#56608
zeyap wants to merge 1 commit into
react:mainfrom
zeyap:export-D102360642

Conversation

@zeyap

@zeyap zeyap commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

Summary:

Changelog:

[Internal] [Fixed] - Fix PixelCopy snapshot for partially off-screen

PixelCopy captures only the visible portion of the window surface.
When a view is partially off-screen, the capture rect extends beyond
the window bounds, resulting in a bitmap where only the visible
region has content. This partial bitmap then gets stretched to fill
the full-size pseudo-element, causing visual distortion.

Fix by clamping the PixelCopy rect to the window bounds and
compositing the clamped capture into a full-size bitmap at the
correct offset. The off-screen portions remain transparent instead
of being stretched.

If the view is entirely off-screen, skip capture entirely — the
pseudo-element will have no snapshot applied (didMountItems skips
tags without a captured bitmap).

Reviewed By: javache

Differential Revision: D102360642

@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 Apr 24, 2026
@meta-codesync

meta-codesync Bot commented Apr 24, 2026

Copy link
Copy Markdown

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

@meta-codesync meta-codesync Bot changed the title Fix PixelCopy snapshot for partially off-screen views Fix PixelCopy snapshot for partially off-screen views (#56608) Apr 24, 2026
zeyap added a commit to zeyap/react-native that referenced this pull request Apr 24, 2026
Summary:

[Internal] [Fixed] - Fix PixelCopy snapshot for partially off-screen 

PixelCopy captures only the visible portion of the window surface.
When a view is partially off-screen, the capture rect extends beyond
the window bounds, resulting in a bitmap where only the visible
region has content. This partial bitmap then gets stretched to fill
the full-size pseudo-element, causing visual distortion.

Fix by clamping the PixelCopy rect to the window bounds and
compositing the clamped capture into a full-size bitmap at the
correct offset. The off-screen portions remain transparent instead
of being stretched.

If the view is entirely off-screen, skip capture entirely — the
pseudo-element will have no snapshot applied (didMountItems skips
tags without a captured bitmap).

Differential Revision: D102360642
@zeyap zeyap force-pushed the export-D102360642 branch from ff6b91c to ce54d82 Compare April 24, 2026 16:59
Summary:

## Changelog:

[Internal] [Fixed] - Fix PixelCopy snapshot for partially off-screen 

PixelCopy captures only the visible portion of the window surface.
When a view is partially off-screen, the capture rect extends beyond
the window bounds, resulting in a bitmap where only the visible
region has content. This partial bitmap then gets stretched to fill
the full-size pseudo-element, causing visual distortion.

Fix by clamping the PixelCopy rect to the window bounds and
compositing the clamped capture into a full-size bitmap at the
correct offset. The off-screen portions remain transparent instead
of being stretched.

If the view is entirely off-screen, skip capture entirely — the
pseudo-element will have no snapshot applied (didMountItems skips
tags without a captured bitmap).

Reviewed By: javache

Differential Revision: D102360642
@zeyap zeyap force-pushed the export-D102360642 branch from ce54d82 to 9caff2d Compare April 27, 2026 14:32
@meta-codesync meta-codesync Bot closed this in 610564c Apr 27, 2026
@react-native-bot

Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @zeyap in 610564c

When will my fix make it into a release? | How to file a pick request?

@react-native-bot react-native-bot added the Merged This PR has been merged. label Apr 27, 2026
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. fb-exported Merged This PR has been merged. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants