Repository: software-mansion/react-native-svg (language: java)

Issue:
[Android] getCurrentColor crash DepsView + Use, java.lang.ClassCastException: com.horcrux.svg.DefsView cannot be cast to com.horcrux.svg.RenderableView
### Description

#2466 introduces new `getCurrentColor` implementation that causes weird crash in Android.

Crash log indicates `getCurrentColor` of `RenderableView` doesn't handle case parent is `DefsView`.

I can't guess how to fix this and tried changing condition `if (parent instanceof VirtualView) {` to `if (parent instanceof VirtualView && !(parent instanceof DefsView)) {` but no luck.

```
FATAL EXCEPTION: main
java.lang.ClassCastException: com.horcrux.svg.DefsView cannot be cast to com.horcrux.svg.RenderableView
	at com.horcrux.svg.RenderableView.getCurrentColor(RenderableView.java:142)
	at com.horcrux.svg.RenderableView.setupPaint(RenderableView.java:652)
	at com.horcrux.svg.RenderableView.setupFillPaint(RenderableView.java:582)
	at com.horcrux.svg.RenderableView.draw(RenderableView.java:520)
	at com.horcrux.svg.UseView.draw(UseView.java:86)
	at com.horcrux.svg.RenderableView.render(RenderableView.java:486)
	at com.horcrux.svg.GroupView.drawGroup(GroupView.java:135)
	at com.horcrux.svg.GroupView.draw(GroupView.java:91)
	at com.horcrux.svg.RenderableView.render(RenderableView.java:486)
	at com.horcrux.svg.GroupView.drawGroup(GroupView.java:135)
	at com.horcrux.svg.GroupView.draw(GroupView.java:91)
	at com.horcrux.svg.RenderableView.render(RenderableView.java:486)
	at com.horcrux.svg.GroupView.drawGroup(GroupView.java:135)
	at com.horcrux.svg.GroupView.draw(GroupView.java:91)
	at com.horcrux.svg.RenderableView.render(RenderableView.java:486)
	at com.horcrux.svg.SvgView.drawChildren(SvgView.java:335)
	at com.horcrux.svg.SvgView.drawOutput(SvgView.java:281)
	at com.horcrux.svg.SvgView.onDraw(SvgView.java:134)
	at android.view.View.draw(View.java:23889)
	at com.facebook.react.views.view.ReactViewGroup.draw(ReactViewGroup.java:970)
	at android.view.View.updateDisplayListIfDirty(View.java:22756)
	at android.view.View.draw(View.java:23620)
	at android.view.ViewGroup.drawChild(ViewGroup.java:4556)
	at com.facebook.react.views.view.ReactViewGroup.drawChild(ReactViewGroup.java:1029)
	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4317)
	at com.facebook.react.views.view.ReactViewGroup.dispatchDraw(ReactViewGroup.java:980)
	at android.view.View.draw(View.java:23892)
	at com.facebook.react.views.view.ReactViewGroup.draw(ReactViewGroup.java:970)
	at android.view.View.updateDisplayListIfDirty(View.java:22756)
	at android.view.View.draw(View.java:23620)
	at android.view.ViewGroup.drawChild(ViewGroup.java:4556)
	at com.facebook.react.views.view.ReactViewGroup.drawChild(ReactViewGroup.java:1029)
	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4317)
	at com.facebook.react.views.view.ReactViewGroup.dispatchDraw(ReactViewGroup.java:980)
	at android.view.View.updateDisplayListIfDirty(View.java:22747)
	at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4540)
	at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4513)
	at android.view.View.updateDisplayListIfDirty(View.java:22712)
	at android.view.View.draw(View.java:23620)
	at android.view.ViewGroup.drawChild(ViewGroup.java:4556)
	at com.facebook.react.views.view.ReactViewGroup.drawChild(ReactViewGroup.java:1029)
	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4317)
	at com.facebook.react.views.view.ReactViewGroup.dispatchDraw(ReactViewGroup.java:980)
	at com.shopify.reactnative.flash_list.AutoLayoutView.dispatchDraw(AutoLayoutView.kt:34)
	at android.view.View.updateDisplayListIfDirty(View.java:22747)
	at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4540)
	at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4513)
	at android.view.View.updateDisplayListIfDirty(View.java:22712)
	at android.view.View.draw(View.java:23620)
	at android.view.ViewGroup.drawChild(ViewGroup.java:4556)
	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4317)
	at android.view.View.draw(View.java:23892)
	at android.widget.ScrollView.draw(ScrollView.java:1971)
	at com.facebook.react.views.scroll.ReactScrollView.draw(ReactScrollView.java:670)
	at android.view.View.updateDisplayListIfDirty(View.java:22756)
	at android.view.View.draw(View.java:23620)
	at android.view.ViewGroup.drawChild(ViewGroup.java:4556)
	at com.facebook.react.views.view.ReactViewGroup.drawChild(ReactViewGroup.java:1029)
	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4317)
```

### Steps to reproduce

svg 

```svg
<svg style="vertical-align:-.72px" xmlns="http://www.w3.org/2000/svg" width="93.992px" height="17.8px" viewBox="0 -943.3 5192.9 983.3" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><path id="a" d="M33 157q0 101 76 192t171 92q51 0 90-49 16 30 46 30 13 0 23-8t10-20q0-13-37-160T374 68q0-25 7-33t21-9q9 1 20 9 21 20 41 96 6 20 10 21 2 1 10 1h4q19 0 19-9 0-6-5-27t-20-54-32-50Q436 0 417-8q-8-2-24-2-34 0-57 15t-30 31l-6 15q-1 1-4-1l-4-4q-59-56-120-56-55 0-97 40T33 157m318 171q0 6-5 22t-23 35-46 20q-35 0-67-31t-50-81q-29-79-41-164v-11q0-8-1-12 0-45 18-62t43-18q38 0 75 33t44 51q2 4 27 107t26 111"/><path id="b" d="M118-162q2 0 6-2t11-3 12-1q13 0 24 13t16 29q10 27 34 153t46 240 22 115v3h-47q-47 0-50 2-4 3-4 10l7 28q2 5 8 5t47 1q48 0 48 1 0 2 9 50t12 58q37 165 146 165 37-2 61-22t24-53q0-36-21-52t-42-17q-44 0-44 42 0 19 11 33t24 21l9 5q-16 6-30 6-12 0-23-10t-15-28q-7-29-16-78t-16-83-7-36 55-2q45 0 52-1t11-6q1-4-2-17t-5-16q-2-5-9-5t-54-1h-56l-23-122Q301 15 282-47q-27-85-70-126-37-32-73-32-32 0-58 19t-26 54q0 37 21 54t42 17q44 0 44-42 0-19-11-33t-24-21z"/><path id="c" d="M94 250q0 69 10 131t23 107 37 88 38 67 42 52 33 34 25 21h17q14 0 14-9 0-3-17-21t-41-53-49-86-42-138-17-193 17-192 41-139 49-86 42-53 17-21q0-9-15-9h-16l-28 24q-94 85-137 212T94 250"/><path id="d" d="M52 289q7 42 54 97t116 56q35 0 64-18t43-45q42 63 101 63 37 0 64-22t28-59q0-29-14-47t-27-22-23-4q-19 0-31 11t-12 29q0 46 50 63-11 13-40 13-13 0-19-2-38-16-56-66-60-221-60-258 0-28 16-40t35-12q37 0 73 33t49 81q3 10 6 11t16 2h4q15 0 15-8 0-1-2-11-16-57-62-101T333-11q-70 0-106 63-41-62-94-62h-6q-49 0-70 26T35 71q0 32 19 52t45 20q43 0 43-42 0-20-12-35t-23-20-13-5l-3-1q0-1 6-4t16-7 19-3q36 0 62 45 9 16 23 68t28 108 16 66q5 27 5 39 0 28-15 40t-34 12q-40 0-75-32t-49-82q-2-9-5-10t-16-2H58q-6 6-6 11"/><path id="e" d="m60 749 4 1h22l28-24q94-85 137-212t43-264q0-68-10-131T261 12t-37-88-38-67-41-51-32-33-23-19l-4-4H63q-3 0-5 3t-3 9q1 1 11 13Q221-64 221 250T66 725q-10 12-11 13 0 8 5 11"/><path id="f" d="M84 520q0 8 4 13t8 6l3 1q7 0 154-69t291-137l143-69q7-5 7-15t-7-15q-2-2-292-139L107-40h-6q-18 2-18 20v3q-1 7 15 16 19 10 150 72 78 37 130 61l248 118-248 118Q90 504 86 509q-2 4-2 11"/><path id="g" d="M311 43q-15-13-44-28T206 0q-63 0-101 45T66 160q0 105 77 193t171 89q47 0 87-48l3 4q2 3 5 6t9 8 13 7 16 3q14 0 23-9t10-19q0-15-57-242T363-80q-18-54-77-89t-135-36q-141 0-141 68 0 26 18 46t46 20q15 0 28-9t14-31q0-10-2-19t-7-14-8-10-7-8l-2-2h1q10-3 60-3 38 0 60 12 23 11 43 33t28 47q6 19 16 62 13 48 13 56m73 285-4 11q-3 11-5 15t-6 14-10 14-13 11-18 9-22 3q-44 0-85-53-30-39-50-119t-20-116q0-79 62-79 56 0 110 70l8 10z"/></defs><g stroke="currentColor" fill="currentColor" stroke-width="0"><g><use data-c="1D44E" xlink:href="#a" transform="scale(1 -1)"/><g data-mjx-texclass="ORD"><use data-c="1D453" xlink:href="#b" transform="scale(1 -1) translate(562 413)scale(.707)"/><use data-c="28" xlink:href="#c" transform="scale(1 -1) translate(562 413)scale(.707) translate(550)"/><use data-c="1D465" xlink:href="#d" transform="scale(1 -1) translate(562 413)scale(.707) translate(939)"/><use data-c="29" xlink:href="#e" transform="scale(1 -1) translate(562 413)scale(.707) translate(1511)"/></g></g><use data-c="3E" xlink:href="#f" transform="scale(1 -1) translate(2233.3)"/><g><use data-c="1D44E" xlink:href="#a" transform="scale(1 -1) translate(3289.1)"/><g data-mjx-texclass="ORD"><use data-c="1D454" xlink:href="#g" transform="scale(1 -1) translate(3289.1) translate(562 413)scale(.707)"/><use data-c="28" xlink:href="#c" transform="scale(1 -1) translate(3289.1) translate(562 413)scale(.707) translate(477)"/><use data-c="1D465" xlink:href="#d" transform="scale(1 -1) translate(3289.1) translate(562 413)scale(.707) translate(866)"/><use data-c="29" xlink:href="#e" transform="scale(1 -1) translate(3289.1) translate(562 413)scale(.707) translate(1438)"/></g></g></g></svg>
```

use `SvgXml` `xml` prop for rendering.

![image](https://github.com/user-attachments/assets/58d7f114-7aa3-473c-b2d6-6f7bfbdee664)


### Snack or a link to a repository

https://snack.expo.dev/@mj-studio/svg-error-reproduce

> [!NOTE]
> I can't reproduce with snack because it doesn't support `15.8.0` yet. But it seems clear how to reproduce it.

### SVG version

15.8.0

### React Native version

0.76

### Platforms

Android

### JavaScript runtime

Hermes

### Workflow

React Native

### Architecture

Paper (Old Architecture)

### Build type

Debug app & dev bundle

### Device

Android emulator

### Device model

_No response_

### Acknowledgements

Yes


Discussion / hints:
Hey! 👋 

It looks like you've omitted a few important sections from the issue template.

Please complete **Description** section.

Fix patch:
diff --git a/android/src/main/java/com/horcrux/svg/RenderableView.java b/android/src/main/java/com/horcrux/svg/RenderableView.java
index cb5750e75..a0b19ea9a 100644
--- a/android/src/main/java/com/horcrux/svg/RenderableView.java
+++ b/android/src/main/java/com/horcrux/svg/RenderableView.java
@@ -96,6 +96,7 @@ public abstract class RenderableView extends VirtualView implements ReactHitSlop
   private @Nullable ArrayList<Object> mOriginProperties;
   private @Nullable ArrayList<String> mPropList;
   private @Nullable ArrayList<String> mAttributeList;
+  private @Nullable RenderableView mCaller;
 
   @Nullable String mFilter;
 
@@ -134,6 +135,9 @@ int getCurrentColor() {
     if (this.mCurrentColor != 0) {
       return this.mCurrentColor;
     }
+    if (this.mCaller != null) {
+      return this.mCaller.getCurrentColor();
+    }
     ViewParent parent = this.getParent();
     if (parent instanceof VirtualView) {
       return ((RenderableView) parent).getCurrentColor();
@@ -756,6 +760,7 @@ private ArrayList<String> getAttributeList() {
   }
 
   void mergeProperties(RenderableView target) {
+    mCaller = target;
     ArrayList<String> targetAttributeList = target.getAttributeList();
 
     if (targetAttributeList == null || targetAttributeList.size() == 0) {
@@ -798,6 +803,7 @@ void resetProperties() {
       mLastMergedList = null;
       mOriginProperties = null;
       mAttributeList = mPropList;
+      mCaller = null;
     }
   }
 
diff --git a/android/src/main/java/com/horcrux/svg/SvgView.java b/android/src/main/java/com/horcrux/svg/SvgView.java
index 346873cca..f00d54c18 100644
--- a/android/src/main/java/com/horcrux/svg/SvgView.java
+++ b/android/src/main/java/com/horcrux/svg/SvgView.java
@@ -11,6 +11,7 @@
 import android.annotation.SuppressLint;
 import android.graphics.Bitmap;
 import android.graphics.Canvas;
+import android.graphics.Color;
 import android.graphics.Matrix;
 import android.graphics.Paint;
 import android.graphics.Rect;
@@ -189,7 +190,7 @@ public int reactTagForTouch(float touchX, float touchY) {
   final Matrix mInvViewBoxMatrix = new Matrix();
   private boolean mInvertible = true;
   private boolean mRendered = false;
-  int mCurrentColor = 0;
+  int mCurrentColor = Color.BLACK;
 
   boolean notRendered() {
     return !mRendered;
diff --git a/apple/Brushes/RNSVGContextBrush.mm b/apple/Brushes/RNSVGContextBrush.mm
index 874fe391a..daa92f699 100644
--- a/apple/Brushes/RNSVGContextBrush.mm
+++ b/apple/Brushes/RNSVGContextBrush.mm
@@ -49,7 +49,7 @@ - (BOOL)applyFillColor:(CGContextRef)context opacity:(CGFloat)opacity
   BOOL fillColor;
 
   if (brush.class == RNSVGBrush.class) {
-    CGContextSetFillColorWithColor(context, [element.tintColor CGColor]);
+    CGContextSetFillColorWithColor(context, [element getCurrentColor]);
     fillColor = YES;
   } else {
     fillColor = [brush applyFillColor:context opacity:opacity];
@@ -70,7 +70,7 @@ - (BOOL)applyStrokeColor:(CGContextRef)context opacity:(CGFloat)opacity
   BOOL strokeColor;
 
   if (brush.class == RNSVGBrush.class) {
-    CGContextSetStrokeColorWithColor(context, [element.tintColor CGColor]);
+    CGContextSetStrokeColorWithColor(context, [element getCurrentColor]);
     strokeColor = YES;
   } else {
     strokeColor = [brush applyStrokeColor:context opacity:opacity];
diff --git a/apple/Elements/RNSVGSvgView.h b/apple/Elements/RNSVGSvgView.h
index c75ddfc66..992ad9405 100644
--- a/apple/Elements/RNSVGSvgView.h
+++ b/apple/Elements/RNSVGSvgView.h
@@ -19,6 +19,7 @@
 
 @interface RNSVGSvgView : RNSVGView <RNSVGContainer>
 
+@property (nonatomic, strong) RNSVGColor *color;
 @property (nonatomic, strong) RNSVGLength *bbWidth;
 @property (nonatomic, strong) RNSVGLength *bbHeight;
 @property (nonatomic, assign) CGFloat minX;
diff --git a/apple/Elements/RNSVGSvgView.mm b/apple/Elements/RNSVGSvgView.mm
index 644a754db..97b4b7269 100644
--- a/apple/Elements/RNSVGSvgView.mm
+++ b/apple/Elements/RNSVGSvgView.mm
@@ -47,8 +47,6 @@ - (instancetype)initWithFrame:(CGRect)frame
     // This is necessary to ensure that [self setNeedsDisplay] actually triggers
     // a redraw when our parent transitions between hidden and visible.
     self.contentMode = UIViewContentModeRedraw;
-    // We don't want the dimming effect on tint as it's used as currentColor
-    self.tintAdjustmentMode = UIViewTintAdjustmentModeNormal;
 #endif // TARGET_OS_OSX
     rendered = false;
 #ifdef RCT_NEW_ARCH_ENABLED
@@ -90,7 +88,7 @@ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &
   self.align = RCTNSStringFromStringNilIfEmpty(newProps.align);
   self.meetOrSlice = intToRNSVGVBMOS(newProps.meetOrSlice);
   if (RCTUIColorFromSharedColor(newProps.color)) {
-    self.tintColor = RCTUIColorFromSharedColor(newProps.color);
+    self.color = RCTUIColorFromSharedColor(newProps.color);
   }
   [super updateProps:props oldProps:oldProps];
 }
@@ -184,10 +182,13 @@ - (void)invalidate
   [self setNeedsDisplay];
 }
 
-- (void)tintColorDidChange
+- (void)setColor:(RNSVGColor *)color
 {
+  if (color == _color) {
+    return;
+  }
   [self invalidate];
-  [self clearChildCache];
+  _color = color;
 }
 
 - (void)setMinX:(CGFloat)minX
diff --git a/apple/RNSVGRenderable.h b/apple/RNSVGRenderable.h
index 82a964a10..7f56488d9 100644
--- a/apple/RNSVGRenderable.h
+++ b/apple/RNSVGRenderable.h
@@ -19,6 +19,7 @@
 @interface RNSVGRenderable : RNSVGNode
 
 @property (class) RNSVGRenderable *contextElement;
+@property (nonatomic, strong) RNSVGColor *color;
 @property (nonatomic, strong) RNSVGBrush *fill;
 @property (nonatomic, assign) CGFloat fillOpacity;
 @property (nonatomic, assign) RNSVGCGFCRule fillRule;
@@ -45,4 +46,6 @@
 
 - (void)resetProperties;
 
+- (CGColor *)getCurrentColor;
+
 @end
diff --git a/apple/RNSVGRenderable.mm b/apple/RNSVGRenderable.mm
index f9d633ec9..0cc82c095 100644
--- a/apple/RNSVGRenderable.mm
+++ b/apple/RNSVGRenderable.mm
@@ -25,6 +25,7 @@ @implementation RNSVGRenderable {
   NSArray<RNSVGLength *> *_sourceStrokeDashArray;
   CGFloat *_strokeDashArrayData;
   CGPathRef _srcHitPath;
+  RNSVGRenderable *_caller;
 }
 
 static RNSVGRenderable *_contextElement;
@@ -61,11 +62,11 @@ - (void)invalidate
 
 - (void)setColor:(RNSVGColor *)color
 {
-  if (color == self.tintColor) {
+  if (color == _color) {
     return;
   }
   [self invalidate];
-  self.tintColor = color;
+  _color = color;
 }
 
 - (void)setFill:(RNSVGBrush *)fill
@@ -560,7 +561,7 @@ - (void)renderLayerTo:(CGContextRef)context rect:(CGRect)rect
 
   if (self.fill) {
     if (self.fill.class == RNSVGBrush.class) {
-      CGContextSetFillColorWithColor(context, [self.tintColor CGColor]);
+      CGContextSetFillColorWithColor(context, [self getCurrentColor]);
       fillColor = YES;
     } else {
       fillColor = [self.fill applyFillColor:context opacity:self.fillOpacity];
@@ -608,7 +609,7 @@ - (void)renderLayerTo:(CGContextRef)context rect:(CGRect)rect
     BOOL strokeColor;
 
     if (self.stroke.class == RNSVGBrush.class) {
-      CGContextSetStrokeColorWithColor(context, [self.tintColor CGColor]);
+      CGContextSetStrokeColorWithColor(context, [self getCurrentColor]);
       strokeColor = YES;
     } else {
       strokeColor = [self.stroke applyStrokeColor:context opacity:self.strokeOpacity];
@@ -724,6 +725,7 @@ - (RNSVGPlatformView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
 
 - (void)mergeProperties:(__kindof RNSVGRenderable *)target
 {
+  _caller = target;
   NSArray<NSString *> *targetAttributeList = [target getAttributeList];
 
   if (targetAttributeList.count == 0) {
@@ -754,9 +756,28 @@ - (void)resetProperties
     [self setValue:[_originProperties valueForKey:key] forKey:key];
   }
 
+  _caller = nil;
   _lastMergedList = nil;
   _attributeList = _propList;
   self.merging = false;
 }
 
+- (CGColor *)getCurrentColor
+{
+  if (self.color != nil) {
+    return [self.color CGColor];
+  }
+  if (_caller != nil) {
+    return [_caller getCurrentColor];
+  }
+  RNSVGPlatformView *parentView = [self superview];
+  if ([parentView isKindOfClass:[RNSVGRenderable class]]) {
+    return [(RNSVGRenderable *)parentView getCurrentColor];
+  } else if ([parentView isKindOfClass:[RNSVGSvgView class]]) {
+    return [[(RNSVGSvgView *)parentView color] CGColor];
+  }
+
+  return nil;
+}
+
 @end
diff --git a/apple/RNSVGUIKit.macos.mm b/apple/RNSVGUIKit.macos.mm
index c4484ff11..9e1caed80 100644
--- a/apple/RNSVGUIKit.macos.mm
+++ b/apple/RNSVGUIKit.macos.mm
@@ -1,7 +1,6 @@
 #import "RNSVGUIKit.h"
 
 @implementation RNSVGView {
-  NSColor *_tintColor;
 }
 
 - (CGPoint)center
@@ -20,29 +19,6 @@ - (void)setCenter:(CGPoint)point
   self.frame = CGRectMake(xOrigin, yOrigin, frameRect.size.width, frameRect.size.height);
 }
 
-- (NSColor *)tintColor
-{
-  if (_tintColor != nil) {
-    return _tintColor;
-  }
-
-  // To mimic iOS's tintColor, we crawl up the view hierarchy until either:
-  // (a) we find a valid color
-  // (b) we reach a view that isn't an RNSVGView
-  NSView *parentView = [self superview];
-  if ([parentView isKindOfClass:[RNSVGView class]]) {
-    return [(RNSVGView *)parentView tintColor];
-  } else {
-    return [NSColor controlAccentColor];
-  }
-}
-
-- (void)setTintColor:(NSColor *)tintColor
-{
-  _tintColor = tintColor;
-  [self setNeedsDisplay:YES];
-}
-
 @end
 
 @implementation NSImage (RNSVGMacOSExtensions)
diff --git a/apple/Text/RNSVGTSpan.mm b/apple/Text/RNSVGTSpan.mm
index 7e00778f4..5f3039eb2 100644
--- a/apple/Text/RNSVGTSpan.mm
+++ b/apple/Text/RNSVGTSpan.mm
@@ -133,7 +133,7 @@ - (void)renderLayerTo:(CGContextRef)context rect:(CGRect)rect
     if (self.inlineSize != nil && self.inlineSize.value != 0) {
       if (self.fill) {
         if (self.fill.class == RNSVGBrush.class) {
-          CGColorRef color = [self.tintColor CGColor];
+          CGColorRef color = [self getCurrentColor];
           [self drawWrappedText:context gc:gc rect:rect color:color];
         } else {
           CGColorRef color = [self.fill getColorWithOpacity:self.fillOpacity];
@@ -143,7 +143,7 @@ - (void)renderLayerTo:(CGContextRef)context rect:(CGRect)rect
       }
       if (self.stroke) {
         if (self.stroke.class == RNSVGBrush.class) {
-          CGColorRef color = [self.tintColor CGColor];
+          CGColorRef color = [self getCurrentColor];
           [self drawWrappedText:context gc:gc rect:rect color:color];
         } else {
           CGColorRef color = [self.stroke getColorWithOpacity:self.strokeOpacity];
diff --git a/apple/ViewManagers/RNSVGRenderableManager.mm b/apple/ViewManagers/RNSVGRenderableManager.mm
index 612de16e3..7beca344f 100644
--- a/apple/ViewManagers/RNSVGRenderableManager.mm
+++ b/apple/ViewManagers/RNSVGRenderableManager.mm
@@ -24,7 +24,7 @@ - (RNSVGRenderable *)node
   return [RNSVGRenderable new];
 }
 
-RCT_REMAP_VIEW_PROPERTY(color, tintColor, UIColor)
+RCT_EXPORT_VIEW_PROPERTY(color, UIColor)
 RCT_EXPORT_VIEW_PROPERTY(fill, RNSVGBrush)
 RCT_EXPORT_VIEW_PROPERTY(fillOpacity, CGFloat)
 RCT_EXPORT_VIEW_PROPERTY(fillRule, RNSVGCGFCRule)
diff --git a/apple/ViewManagers/RNSVGSvgViewManager.mm b/apple/ViewManagers/RNSVGSvgViewManager.mm
index a9e5bee57..73ebd2407 100644
--- a/apple/ViewManagers/RNSVGSvgViewManager.mm
+++ b/apple/ViewManagers/RNSVGSvgViewManager.mm
@@ -26,7 +26,7 @@ - (RNSVGPlatformView *)view
 RCT_EXPORT_VIEW_PROPERTY(vbHeight, CGFloat)
 RCT_EXPORT_VIEW_PROPERTY(align, NSString)
 RCT_EXPORT_VIEW_PROPERTY(meetOrSlice, RNSVGVBMOS)
-RCT_REMAP_VIEW_PROPERTY(color, tintColor, UIColor)
+RCT_EXPORT_VIEW_PROPERTY(color, UIColor)
 RCT_CUSTOM_VIEW_PROPERTY(hitSlop, UIEdgeInsets, RNSVGSvgView)
 {
   if ([view respondsToSelector:@selector(setHitTestEdgeInsets:)]) {
diff --git a/src/elements/Svg.tsx b/src/elements/Svg.tsx
index 36edd2cec..1656c3577 100644
--- a/src/elements/Svg.tsx
+++ b/src/elements/Svg.tsx
@@ -107,7 +107,6 @@ export default class Svg extends Shape<SvgProps> {
       ...extracted,
     };
     let {
-      color,
       width,
       height,
       focusable,
@@ -173,8 +172,6 @@ export default class Svg extends Shape<SvgProps> {
 
     extractResponder(props, props, this as ResponderInstanceProps);
 
-    props.tintColor = color;
-
     if (onLayout != null) {
       props.onLayout = onLayout;
     }


Test patch:
diff --git a/apps/common/test/Test2520.tsx b/apps/common/test/Test2520.tsx
new file mode 100644
index 000000000..97791c5b6
--- /dev/null
+++ b/apps/common/test/Test2520.tsx
@@ -0,0 +1,32 @@
+import React from 'react';
+import {View} from 'react-native';
+import {Defs, G, Rect, Svg, Use} from 'react-native-svg';
+
+export default () => {
+  return (
+    <View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
+      <Svg width="100" height="100" viewBox="0 0 100 100" color="red">
+        {/* @ts-ignore */}
+        <Defs color="blue">
+          <G color="green">
+            <Rect
+              id="a"
+              x="0"
+              y="0"
+              width="50"
+              height="50"
+              fill="currentColor"
+            />
+          </G>
+        </Defs>
+        <G color="pink">
+          <Use href="#a" />
+        </G>
+        <Use href="#a" transform="translate(25 25)" />
+        <G color="green">
+          <Use href="#a" transform="translate(50 50)" />
+        </G>
+      </Svg>
+    </View>
+  );
+};
diff --git a/apps/common/test/index.tsx b/apps/common/test/index.tsx
index 131e6befb..251336f76 100644
--- a/apps/common/test/index.tsx
+++ b/apps/common/test/index.tsx
@@ -34,6 +34,7 @@ import Test2407 from './Test2407';
 import Test2417 from './Test2417';
 import Test2455 from './Test2455';
 import Test2471 from './Test2471';
+import Test2520 from './Test2520';
 
 export default function App() {
   return <ColorTest />;