First attempt at partial currentColor support

This commit is contained in:
Mikael Sand
2018-10-04 22:17:18 +03:00
parent ad99f97c84
commit 1827b91883
7 changed files with 39 additions and 3 deletions
@@ -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;