-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
What happened?
When taking a screenshot of a view, react native skia content does not show up.
More data, please!
This issue occures because detox uses a views internal draw function to create the screenshots:
Detox/detox/android/detox/src/main/java/com/wix/detox/espresso/action/ViewScreenshot.kt
Lines 20 to 27 in 620ca86
| class ViewScreenshot() { | |
| fun takeOf(view: View): ScreenshotResult { | |
| val bitmap = Bitmap.createBitmap(view.width, view.height, Bitmap.Config.ARGB_8888) | |
| view.draw(Canvas(bitmap)) | |
| return ScreenshotResult(bitmap) | |
| } | |
| } |
rn skia uses a TextureView to draw its contents, this however does not support drawing itself to canvas:
Subclasses of TextureView cannot do their own rendering with the [Canvas](https://developer.android.com/reference/android/graphics/Canvas) object.
https://developer.android.com/reference/android/view/TextureView#draw(android.graphics.Canvas)
It seems possible to implement the desired behaviour through the getBitmap method of TextureView though:
https://github.com/facebook/screenshot-tests-for-android/pull/71/files
The skia maintainer confirmed this issue some time ago already:
Shopify/react-native-skia#1880