android:fix cannot change width and height after rendered

This commit is contained in:
pengfei.zhou 2020-03-23 15:59:09 +08:00 committed by osborn
parent 1e22555248
commit 7f16aa23ae
2 changed files with 6 additions and 3 deletions

View File

@ -105,6 +105,7 @@ public abstract class SuperNode<V extends View> extends ViewNode<V> {
layoutParams.width = ViewGroup.LayoutParams.MATCH_PARENT; layoutParams.width = ViewGroup.LayoutParams.MATCH_PARENT;
break; break;
default: default:
layoutParams.width = Math.max(0, layoutParams.width);
break; break;
} }
} }
@ -117,6 +118,7 @@ public abstract class SuperNode<V extends View> extends ViewNode<V> {
layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT; layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT;
break; break;
default: default:
layoutParams.height = Math.max(0, layoutParams.height);
break; break;
} }
} }

View File

@ -117,6 +117,10 @@ public abstract class ViewNode<T extends View> extends DoricContextHolder {
public void blend(JSObject jsObject) { public void blend(JSObject jsObject) {
if (jsObject != null) { if (jsObject != null) {
JSValue value = jsObject.getProperty("layoutConfig");
if (value.isObject()) {
setLayoutConfig(value.asObject());
}
for (String prop : jsObject.propertySet()) { for (String prop : jsObject.propertySet()) {
blend(mView, prop, jsObject.getProperty(prop)); blend(mView, prop, jsObject.getProperty(prop));
} }
@ -252,9 +256,6 @@ public abstract class ViewNode<T extends View> extends DoricContextHolder {
} }
}); });
break; break;
case "layoutConfig":
setLayoutConfig(prop.asObject());
break;
case "border": case "border":
if (prop.isObject()) { if (prop.isObject()) {
requireDoricLayer().setBorder(DoricUtils.dp2px(prop.asObject().getProperty("width").asNumber().toFloat()), requireDoricLayer().setBorder(DoricUtils.dp2px(prop.asObject().getProperty("width").asNumber().toFloat()),