react-native-view-shot icon indicating copy to clipboard operation
react-native-view-shot copied to clipboard

on Android, capture GL Views: handleGLSurfaceViewOnAndroid

Open michalis-ligopsychakis opened this issue 2 years ago • 2 comments

Hello everyone :) I am trying to capture a screenshot on android but I get blank image. I want to ask, where can I use the "handleGLSurfaceViewOnAndroid" prop in order to fix that ..?

react-native: 0.64.4 react-native-view-shot: 3.1.2 @viro-community/react-viro: 2.23.0

michalis-ligopsychakis avatar Apr 21 '23 11:04 michalis-ligopsychakis

Hey there, fellow react-viro user :)

I'm using React Native 0.71.7 so it might be that this won't work in your case, but this works for me:

captureScreen({
  format: "jpg",
  quality: 0.8,
  handleGLSurfaceViewOnAndroid: true // <-- add this property here
}).then(
  (uri) => console.log("Image saved to", uri),
  (error) => console.error("Oops, snapshot failed", error)
);

Weirdly enough, this only captures the Viro view, any other React Native components that are above it are not included in the resulting screenshot.

skizzo avatar May 17 '23 20:05 skizzo