From 6a7e23a45541f009e3d52bd64414d6332d2b7579 Mon Sep 17 00:00:00 2001 From: Srikanth Date: Tue, 16 Dec 2025 18:26:07 +0530 Subject: [PATCH 1/2] Update ViewScreenshotService.java Now supports SVGs from react-native-svg --- .../reactnative/skia/ViewScreenshotService.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/skia/android/src/main/java/com/shopify/reactnative/skia/ViewScreenshotService.java b/packages/skia/android/src/main/java/com/shopify/reactnative/skia/ViewScreenshotService.java index 127f91f325..c6d0fb9a1c 100644 --- a/packages/skia/android/src/main/java/com/shopify/reactnative/skia/ViewScreenshotService.java +++ b/packages/skia/android/src/main/java/com/shopify/reactnative/skia/ViewScreenshotService.java @@ -67,6 +67,16 @@ private static Paint createPaint() { return paint; } + private static boolean isSvgView(View view) { + try { + String className = view.getClass().getName(); + return className != null && className.startsWith("com.horcrux.svg"); + } catch (Throwable t) { + Log.e("SvgCheck", "Error checking class name", t); + return false; + } + } + private static void renderViewToCanvas(Canvas canvas, View view, Paint paint, float parentOpacity) { float combinedOpacity = parentOpacity * view.getAlpha(); canvas.save(); @@ -83,7 +93,7 @@ private static void renderViewToCanvas(Canvas canvas, View view, Paint paint, fl canvas.clipRect(clipLeft, clipTop, clipRight, clipBottom); } - if (view instanceof ViewGroup) { + if (view instanceof ViewGroup && !isSvgView(view)) { ViewGroup group = (ViewGroup) view; drawBackgroundIfPresent(canvas, view, combinedOpacity); drawChildren(canvas, group, paint, combinedOpacity); From ff4b55b27ace956562f3ebf0b8a29315f33213ad Mon Sep 17 00:00:00 2001 From: Srikanth Date: Wed, 17 Dec 2025 16:13:48 +0530 Subject: [PATCH 2/2] Fix indentation Improved logging --- .../reactnative/skia/ViewScreenshotService.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/skia/android/src/main/java/com/shopify/reactnative/skia/ViewScreenshotService.java b/packages/skia/android/src/main/java/com/shopify/reactnative/skia/ViewScreenshotService.java index c6d0fb9a1c..f9922190a0 100644 --- a/packages/skia/android/src/main/java/com/shopify/reactnative/skia/ViewScreenshotService.java +++ b/packages/skia/android/src/main/java/com/shopify/reactnative/skia/ViewScreenshotService.java @@ -68,13 +68,13 @@ private static Paint createPaint() { } private static boolean isSvgView(View view) { - try { - String className = view.getClass().getName(); - return className != null && className.startsWith("com.horcrux.svg"); - } catch (Throwable t) { - Log.e("SvgCheck", "Error checking class name", t); - return false; - } + try { + String className = view.getClass().getName(); + return className != null && className.startsWith("com.horcrux.svg"); + } catch (Throwable t) { + Log.e("ViewScreenshotService", "Error checking if view is SVG", t); + return false; + } } private static void renderViewToCanvas(Canvas canvas, View view, Paint paint, float parentOpacity) {