mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-05 07:59:28 +00:00
[android] Fix Use element spec conformance (x and y interpretation)
This commit is contained in:
@@ -644,6 +644,16 @@ class RenderableViewManager extends ViewGroupManager<VirtualView> {
|
||||
node.setHref(href);
|
||||
}
|
||||
|
||||
@ReactProp(name = "x")
|
||||
public void setX(UseView node, Dynamic x) {
|
||||
node.setX(x);
|
||||
}
|
||||
|
||||
@ReactProp(name = "y")
|
||||
public void setY(UseView node, Dynamic y) {
|
||||
node.setY(y);
|
||||
}
|
||||
|
||||
@ReactProp(name = "width")
|
||||
public void setWidth(UseView node, Dynamic width) {
|
||||
node.setWidth(width);
|
||||
|
||||
@@ -23,6 +23,8 @@ import com.facebook.react.uimanager.annotations.ReactProp;
|
||||
@SuppressLint("ViewConstructor")
|
||||
class UseView extends RenderableView {
|
||||
private String mHref;
|
||||
private SVGLength mX;
|
||||
private SVGLength mY;
|
||||
private SVGLength mW;
|
||||
private SVGLength mH;
|
||||
|
||||
@@ -36,6 +38,18 @@ class UseView extends RenderableView {
|
||||
invalidate();
|
||||
}
|
||||
|
||||
@ReactProp(name = "x")
|
||||
public void setX(Dynamic x) {
|
||||
mX = getLengthFromDynamic(x);
|
||||
invalidate();
|
||||
}
|
||||
|
||||
@ReactProp(name = "y")
|
||||
public void setY(Dynamic y) {
|
||||
mY = getLengthFromDynamic(y);
|
||||
invalidate();
|
||||
}
|
||||
|
||||
@ReactProp(name = "width")
|
||||
public void setWidth(Dynamic width) {
|
||||
mW = getLengthFromDynamic(width);
|
||||
@@ -53,6 +67,7 @@ class UseView extends RenderableView {
|
||||
VirtualView template = getSvgView().getDefinedTemplate(mHref);
|
||||
|
||||
if (template != null) {
|
||||
canvas.translate((float) relativeOnWidth(mX), (float) relativeOnHeight(mY));
|
||||
if (template instanceof RenderableView) {
|
||||
((RenderableView)template).mergeProperties(this);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user