Open dani-benet opened 1 month ago
@WoLewicki it looks like RN SVG is using a type of view that we are not handling there: https://github.com/Shopify/react-native-skia/blob/main/package/android/src/main/java/com/shopify/reactnative/skia/ViewScreenshotService.java#L123
We handle SurfaceView and TextureView, but maybe RN SVG is using something else?
Hmm, react-native-svg
views extend ReactViewGroup
: https://github.com/software-mansion/react-native-svg/blob/acd29d74682f04a53336b716dec0e98af8d0fa01/android/src/main/java/com/horcrux/svg/SvgView.java#L37, https://github.com/software-mansion/react-native-svg/blob/acd29d74682f04a53336b716dec0e98af8d0fa01/android/src/main/java/com/horcrux/svg/VirtualView.java#L32.
We override onDraw
: https://github.com/software-mansion/react-native-svg/blob/acd29d74682f04a53336b716dec0e98af8d0fa01/android/src/main/java/com/horcrux/svg/SvgView.java#L125 so this might be not handled properly by react-native-skia
? Not sure though.
Thanks this is very helpful. If gre/react-native-view-shot handles it well, we will be able to do it as well: https://github.com/gre/react-native-view-shot/blob/master/android/src/main/java/fr/greweb/reactnativeviewshot/ViewShot.java
I'd guess react-native-svg
views propably go here: https://github.com/Shopify/react-native-skia/blob/aadd424a5a9be215fee5f400ae0029a0180ad367/package/android/src/main/java/com/shopify/reactnative/skia/ViewScreenshotService.java#L86 and then here: https://github.com/Shopify/react-native-skia/blob/aadd424a5a9be215fee5f400ae0029a0180ad367/package/android/src/main/java/com/shopify/reactnative/skia/ViewScreenshotService.java#L110-L114 and I think it is not the proper way.
Description
I'm creating a popper-like component that snapshots a component and puts the image in top of a dark overlay ->
https://github.com/user-attachments/assets/2ffd3699-2b08-4d1a-9711-ddb1cde2c4a2
But I'm facing an issue on Android where the SVG's created using react native reanimated are not shown in the snapshots. See on the next video the cursor on the top-left disappears.
https://github.com/user-attachments/assets/e85e7e68-b5db-4003-879d-b862606cedcd
Version
1.3.9 and also tried it on 1.2.3
Steps to reproduce
Make a snapshot of any svg in Android and it doesn't work.
Snack, code example, screenshot, or link to a repository
I've managed to reproduce the issue with this sample code
on iOS it's visible but not on Android
To render the svg I use the
react-native-svg
library