Add RenderableView, fix names. Allow percentages in nested SVG (iOS).

This commit is contained in:
Mikael Sand
2018-03-17 23:22:40 +02:00
parent a3c9aa2872
commit 7deabf8287
4 changed files with 41 additions and 7 deletions
@@ -125,8 +125,8 @@ abstract public class RenderableShadowNode extends VirtualNode {
}
@ReactProp(name = "strokeDashoffset")
public void setStrokeDashoffset(float strokeWidth) {
mStrokeDashoffset = strokeWidth * mScale;
public void setStrokeDashoffset(float strokeDashoffset) {
mStrokeDashoffset = strokeDashoffset * mScale;
markUpdated();
}
@@ -0,0 +1,32 @@
package com.horcrux.svg;
import android.view.ViewGroup;
import com.facebook.react.bridge.ReactContext;
public class RenderableView extends ViewGroup {
VirtualNode shadowNode;
public RenderableView(ReactContext reactContext) {
super(reactContext);
}
VirtualNode getShadowNode() {
return shadowNode;
}
@Override
public void setId(int id) {
super.setId(id);
shadowNode = RenderableViewManager.getShadowNodeByTag(id);
}
void dropView() {
shadowNode = null;
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
}
}
@@ -572,8 +572,8 @@ class RenderableViewManager extends ViewGroupManager<RenderableView> {
}
@ReactProp(name = "fillOpacity", defaultFloat = 1f)
public void setFillOpacity(RenderableView node, float opacity) {
((RenderableShadowNode) node.getShadowNode()).setFillOpacity(opacity);
public void setFillOpacity(RenderableView node, float fillOpacity) {
((RenderableShadowNode) node.getShadowNode()).setFillOpacity(fillOpacity);
}
@ReactProp(name = "fillRule", defaultInt = FILL_RULE_NONZERO)
@@ -598,8 +598,8 @@ class RenderableViewManager extends ViewGroupManager<RenderableView> {
}
@ReactProp(name = "strokeDashoffset")
public void setStrokeDashoffset(RenderableView node, float strokeWidth) {
((RenderableShadowNode) node.getShadowNode()).setStrokeDashoffset(strokeWidth);
public void setStrokeDashoffset(RenderableView node, float strokeDashoffset) {
((RenderableShadowNode) node.getShadowNode()).setStrokeDashoffset(strokeDashoffset);
}
@ReactProp(name = "strokeWidth")