mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-04 23:54:53 +00:00
First attempt at partial currentColor support
This commit is contained in:
@@ -394,6 +394,9 @@ abstract public class RenderableShadowNode extends VirtualNode {
|
||||
}
|
||||
brush.setupPaint(paint, mBox, mScale, opacity);
|
||||
}
|
||||
} else if (colorType == 2) {
|
||||
int brush = getSvgShadowNode().mTintColor;
|
||||
paint.setColor(brush);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,6 +30,8 @@ import java.io.ByteArrayOutputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Shadow node for RNSVG virtual tree root - RNSVGSvgView
|
||||
*/
|
||||
@@ -54,6 +56,7 @@ public class SvgViewShadowNode extends LayoutShadowNode {
|
||||
private Matrix mInvViewBoxMatrix = new Matrix();
|
||||
private boolean mInvertible = true;
|
||||
private boolean mRendered = false;
|
||||
int mTintColor = 0;
|
||||
|
||||
public SvgViewShadowNode() {
|
||||
mScale = DisplayMetricsHolder.getScreenDisplayMetrics().density;
|
||||
@@ -74,6 +77,15 @@ public class SvgViewShadowNode extends LayoutShadowNode {
|
||||
});
|
||||
}
|
||||
|
||||
@ReactProp(name = "tintColor", customType = "Color")
|
||||
public void setTintColor(@Nullable Integer tintColor) {
|
||||
if (tintColor == null) {
|
||||
mTintColor = 0;
|
||||
} else {
|
||||
mTintColor = tintColor;
|
||||
}
|
||||
}
|
||||
|
||||
@ReactProp(name = "minX")
|
||||
public void setMinX(float minX) {
|
||||
mMinX = minX;
|
||||
|
||||
Reference in New Issue
Block a user