Fixes for animation of width and height

This commit is contained in:
Mikael Sand
2018-10-10 22:35:25 +03:00
parent b13e164e22
commit e307eeee57
8 changed files with 75 additions and 15 deletions
@@ -13,6 +13,9 @@ import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.RectF;
import com.facebook.react.bridge.Dynamic;
import com.facebook.react.bridge.ReadableType;
import com.facebook.react.uimanager.annotations.ReactProp;
/**
@@ -41,15 +44,22 @@ class RectShadowNode extends RenderableShadowNode {
}
@ReactProp(name = "rectwidth")
public void setWidth(String width) {
mW = width;
public void setWidth(Dynamic width) {
if (width.getType() == ReadableType.String) {
mW = width.asString();
} else {
mW = String.valueOf(width.asDouble());
}
markUpdated();
}
@ReactProp(name = "rectheight")
public void setHeight(String height) {
mH = height;
public void setHeight(Dynamic height) {
if (height.getType() == ReadableType.String) {
mH = height.asString();
} else {
mH = String.valueOf(height.asDouble());
}
markUpdated();
}
@@ -304,13 +304,13 @@ class RenderableViewManager<T extends VirtualNode> extends ViewGroupManager<Rend
}
@ReactProp(name = "rectwidth")
public void setWidth(RenderableView<RectShadowNode> node, String width) {
public void setWidth(RenderableView<RectShadowNode> node, Dynamic width) {
node.shadowNode.setWidth(width);
}
@ReactProp(name = "rectheight")
public void setHeight(RenderableView<RectShadowNode> node, String height) {
public void setHeight(RenderableView<RectShadowNode> node, Dynamic height) {
node.shadowNode.setHeight(height);
}