exodeui-react-native 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/engine.ts +31 -27
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "exodeui-react-native",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "React Native runtime for ExodeUI animations",
5
5
  "main": "index.js",
6
6
  "files": [
package/src/engine.ts CHANGED
@@ -2105,11 +2105,11 @@ export class ExodeUIEngine {
2105
2105
  const svgContent = geometry.svgContent;
2106
2106
  if (!svgContent) return;
2107
2107
 
2108
- // Extract path data from potentially multiple <path d="..."> tags
2109
- const pathMatches = svgContent.matchAll(/d="([^"]+)"/g);
2108
+ // Extract path data from potentially multiple <path d="..."> or d='...' tags
2109
+ const pathMatches = svgContent.matchAll(/d=["']([^"']+)["']/g);
2110
2110
  const paths: string[] = [];
2111
2111
  for (const match of pathMatches) {
2112
- paths.push(match[1] as string);
2112
+ if (match[1]) paths.push(match[1]);
2113
2113
  }
2114
2114
 
2115
2115
  if (paths.length === 0) return;
@@ -2118,30 +2118,34 @@ export class ExodeUIEngine {
2118
2118
  const style = state?.style || obj.style || {};
2119
2119
 
2120
2120
  paths.forEach(d => {
2121
- const path = Skia.Path.MakeFromSVGString(d);
2122
- if (!path) return;
2123
-
2124
- // Draw fill
2125
- if (style.fill && style.fill.type !== 'None') {
2126
- const paint = Skia.Paint();
2127
- const fillCol = style.fill.color || '#ffffff';
2128
- const fillColStr = typeof fillCol === 'string' ? fillCol.replace(/\s+/g, '') : '#ffffff';
2129
- try { paint.setColor(Skia.Color(fillColStr)); } catch { paint.setColor(Skia.Color('#ffffff')); }
2130
- paint.setAlphaf((state?.opacity ?? 1) * (style.fill.opacity ?? 1));
2131
- paint.setStyle(PaintStyle.Fill);
2132
- canvas.drawPath(path, paint);
2133
- }
2134
-
2135
- // Draw stroke if enabled
2136
- if (style.stroke && style.stroke.width > 0 && style.stroke.isEnabled !== false) {
2137
- const paint = Skia.Paint();
2138
- const strokeCol = style.stroke.color || '#000000';
2139
- const strokeColStr = typeof strokeCol === 'string' ? strokeCol.replace(/\s+/g, '') : '#000000';
2140
- try { paint.setColor(Skia.Color(strokeColStr)); } catch { paint.setColor(Skia.Color('#000000')); }
2141
- paint.setStrokeWidth(style.stroke.width);
2142
- paint.setAlphaf((state?.opacity ?? 1) * (style.stroke.opacity ?? 1));
2143
- paint.setStyle(PaintStyle.Stroke);
2144
- canvas.drawPath(path, paint);
2121
+ try {
2122
+ const path = Skia.Path.MakeFromSVGString(d);
2123
+ if (!path) return;
2124
+
2125
+ // Draw fill
2126
+ if (style.fill && style.fill.type !== 'None') {
2127
+ const paint = Skia.Paint();
2128
+ const fillCol = style.fill.color || '#ffffff';
2129
+ const fillColStr = typeof fillCol === 'string' ? fillCol.replace(/\s+/g, '') : '#ffffff';
2130
+ try { paint.setColor(Skia.Color(fillColStr)); } catch { paint.setColor(Skia.Color('#ffffff')); }
2131
+ paint.setAlphaf((state?.opacity ?? 1) * (style.fill.opacity ?? 1));
2132
+ paint.setStyle(PaintStyle.Fill);
2133
+ canvas.drawPath(path, paint);
2134
+ }
2135
+
2136
+ // Draw stroke if enabled
2137
+ if (style.stroke && style.stroke.width > 0 && style.stroke.isEnabled !== false) {
2138
+ const paint = Skia.Paint();
2139
+ const strokeCol = style.stroke.color || '#000000';
2140
+ const strokeColStr = typeof strokeCol === 'string' ? strokeCol.replace(/\s+/g, '') : '#000000';
2141
+ try { paint.setColor(Skia.Color(strokeColStr)); } catch { paint.setColor(Skia.Color('#000000')); }
2142
+ paint.setStrokeWidth(style.stroke.width);
2143
+ paint.setAlphaf((state?.opacity ?? 1) * (style.stroke.opacity ?? 1));
2144
+ paint.setStyle(PaintStyle.Stroke);
2145
+ canvas.drawPath(path, paint);
2146
+ }
2147
+ } catch (e) {
2148
+ console.warn(`[ExodeUIEngine] Failed to parse SVG path for ${obj.id}:`, e);
2145
2149
  }
2146
2150
  });
2147
2151
  }