Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

attachScreenshot option can result in a blank UI on Android #3314

Closed
4 tasks done
liamjones opened this issue Oct 2, 2023 · 6 comments · Fixed by getsentry/sentry-java#3008
Closed
4 tasks done

attachScreenshot option can result in a blank UI on Android #3314

liamjones opened this issue Oct 2, 2023 · 6 comments · Fixed by getsentry/sentry-java#3008

Comments

@liamjones
Copy link
Contributor

Platform:

  • Android

SDK:

  • @sentry/react-native (>= 1.0.0)

SDK version: 5.9.2

react-native version: 0.71.13

Are you using Expo?

  • No

Are you using sentry.io or on-premise?

  • sentry.io (SaaS)

If you are using sentry.io, please post a link to your issue so we can take a look:

N/A

Configuration:

(@sentry/react-native)

Sentry.init({
  dsn: 'https://[email protected]/4505951781191680',
  enabled: false,
  attachScreenshot: true,
});

I have following issue:

There seems to be a timing-related issue between @sentry/react-native (or sentry-android) and react-native-screens / @react-navigation/native-stack on Android. If Sentry tries to capture a screenshot near to/during navigation occurring and a new activity being mounted the activity's view becomes invisible (but it is still possible to interact with the invisible elements).

Steps to reproduce:

  • Enable attachScreenshot option
  • Call Sentry.captureException() while navigation is occuring.

Actual result:

UI displays blank. See video below.

Expected result:

attachScreenshot does not interfere with the rendering of the UI.

Minimal repro:

Clone https://github.com/liamjones/sentry-screenshot-bug, build & launch the app then tap the Navigate button. If the problem doesn't happen try tweaking the constants in the top of App.tsx. Since it's a timing-related issue it's a fine balance between triggering the issue reliably vs asking the JS thread to do too much. I think it's also related to the layout of the newly mounted screen taking a long time (hence rendering a bunch of SVGs in the screen in the repro). Video using the repo which shows it happening 2 out of 3 times: https://drive.google.com/file/d/14p0Cv60Gv1rLcVLHaT7YHKDxT-RmrbxD/view?usp=sharing

@liamjones
Copy link
Contributor Author

liamjones commented Oct 2, 2023

Also, something I noticed while building this repro, attachScreenshot: true seems to be doing processing even when enabled: false. Is this a separate bug or is that deliberate?

@krystofwoldrich
Copy link
Member

Thank you for the information and the reproducible example,
we will check this.

@krystofwoldrich
Copy link
Member

Also, something I noticed while building this repro, attachScreenshot: true seems to be doing processing even when enabled: false. Is this a separate bug or is that deliberate?

I believe screenshots should not be taken when SDK is disabled, let's handle this as a separate issue.

@krystofwoldrich
Copy link
Member

Though the consts are machine-dependent I'm posting the config I manager to reproduce the issue with.

const INTERVAL_FOR_TAKING_SCREENSHOTS = 5;
const TIMEOUT_TO_STOP_CAPTURING_SCREENSHOTS_AFTER_DETAILS_SCREEN_IS_RENDERED = 100;
const HOW_MANY_SVGS_TO_RENDER_ON_DETAILS_SCREEN = 100;

@liamjones
Copy link
Contributor Author

Let's handle this as a separate issue.

Sure, I'll get one raised.

@krystofwoldrich
Copy link
Member

Using the pixelCopy API fixes the issue.

https://github.com/getsentry/sentry-java/tree/feat/pixel-copy-api-for-screenshots

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants