From 7f16aa23ae92db4b4ff4cef2a0b7c2215b930e75 Mon Sep 17 00:00:00 2001 From: "pengfei.zhou" Date: Mon, 23 Mar 2020 15:59:09 +0800 Subject: [PATCH] android:fix cannot change width and height after rendered --- .../doric/src/main/java/pub/doric/shader/SuperNode.java | 2 ++ .../doric/src/main/java/pub/doric/shader/ViewNode.java | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/doric-android/doric/src/main/java/pub/doric/shader/SuperNode.java b/doric-android/doric/src/main/java/pub/doric/shader/SuperNode.java index b03d55aa..0bfa6f4c 100644 --- a/doric-android/doric/src/main/java/pub/doric/shader/SuperNode.java +++ b/doric-android/doric/src/main/java/pub/doric/shader/SuperNode.java @@ -105,6 +105,7 @@ public abstract class SuperNode extends ViewNode { layoutParams.width = ViewGroup.LayoutParams.MATCH_PARENT; break; default: + layoutParams.width = Math.max(0, layoutParams.width); break; } } @@ -117,6 +118,7 @@ public abstract class SuperNode extends ViewNode { layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT; break; default: + layoutParams.height = Math.max(0, layoutParams.height); break; } } diff --git a/doric-android/doric/src/main/java/pub/doric/shader/ViewNode.java b/doric-android/doric/src/main/java/pub/doric/shader/ViewNode.java index ac72bef1..2c642446 100644 --- a/doric-android/doric/src/main/java/pub/doric/shader/ViewNode.java +++ b/doric-android/doric/src/main/java/pub/doric/shader/ViewNode.java @@ -117,6 +117,10 @@ public abstract class ViewNode extends DoricContextHolder { public void blend(JSObject jsObject) { if (jsObject != null) { + JSValue value = jsObject.getProperty("layoutConfig"); + if (value.isObject()) { + setLayoutConfig(value.asObject()); + } for (String prop : jsObject.propertySet()) { blend(mView, prop, jsObject.getProperty(prop)); } @@ -252,9 +256,6 @@ public abstract class ViewNode extends DoricContextHolder { } }); break; - case "layoutConfig": - setLayoutConfig(prop.asObject()); - break; case "border": if (prop.isObject()) { requireDoricLayer().setBorder(DoricUtils.dp2px(prop.asObject().getProperty("width").asNumber().toFloat()),