Skip to content

Commit

Permalink
Fix black snapshot issue
Browse files Browse the repository at this point in the history
Summary:
Many users are reporting an issue with a black snapshot occuring on messenger and fbios.

https://fb.workplace.com/groups/flippersupport/permalink/1935441610269821/

This is because the snapshotting code snapshots all windows in order and composites them together. https://fburl.com/code/gcnbkpda

The issue is the app can add additional windows such as this one
{F1916776068}

which itself it full screen and contains an empty view which effetively covers the real content with black pixels. Additionally react native adds a window to display the debug with metro banner

I dont know how in the real app this doesst paint over the real content but for whatever it causes issues with our snapshotting process

The solution is to only snapshot the active child of the application. This is how it works on android.

The theory is that if we are only traversing the key window (active chld means we dont traverse other children) we should also only snapshot that one

Reviewed By: lblasa

Differential Revision: D64044875

fbshipit-source-id: 9ed83a0ef5f89948f1575c09f496384471985a56
  • Loading branch information
Luke De Feo authored and facebook-github-bot committed Oct 9, 2024
1 parent 619b5e7 commit ec35ca0
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,12 @@ - (UIDBounds*)boundsForNode:(UIApplication*)node {
}

- (UIImage*)snapshotForNode:(UIApplication*)node {
return UIDApplicationSnapshot(node, [self childrenOfNode:node]);
NSMutableArray<UIWindow*>* windows = [NSMutableArray new];
UIWindow* window = node.keyWindow;
if (window != nil) {
[windows addObject:window];
}
return UIDApplicationSnapshot(node, windows);
}

@end
Expand Down

0 comments on commit ec35ca0

Please sign in to comment.