diff --git a/driver/js/packages/hippy-vue/src/renderer/native/index.js b/driver/js/packages/hippy-vue/src/renderer/native/index.js index 82c18710a37..e9ecacd3ec7 100644 --- a/driver/js/packages/hippy-vue/src/renderer/native/index.js +++ b/driver/js/packages/hippy-vue/src/renderer/native/index.js @@ -666,7 +666,7 @@ function updateChild(parentNode, notUpdateStyle = false) { let eventNode; let printedNode; if (notUpdateStyle) { - nativeNode = getNativeNode(rootViewId, parentNode, refInfo); + nativeNode = getNativeNode(rootViewId, parentNode); } else { [nativeNode, eventNode, printedNode] = renderToNative(rootViewId, parentNode); } diff --git a/renderer/native/android/src/main/java/com/tencent/mtt/hippy/uimanager/ControllerManager.java b/renderer/native/android/src/main/java/com/tencent/mtt/hippy/uimanager/ControllerManager.java index 942c73d2b73..d67d77df63c 100644 --- a/renderer/native/android/src/main/java/com/tencent/mtt/hippy/uimanager/ControllerManager.java +++ b/renderer/native/android/src/main/java/com/tencent/mtt/hippy/uimanager/ControllerManager.java @@ -18,13 +18,11 @@ import static com.tencent.renderer.NativeRenderException.ExceptionCode.ADD_CHILD_VIEW_FAILED_ERR; import static com.tencent.renderer.NativeRenderException.ExceptionCode.REMOVE_CHILD_VIEW_FAILED_ERR; -import static com.tencent.renderer.NativeRenderer.SCREEN_SNAPSHOT_ROOT_ID; import static com.tencent.renderer.node.RenderNode.FLAG_ALREADY_UPDATED; import static com.tencent.renderer.node.RenderNode.FLAG_UPDATE_LAYOUT; import android.view.View; import android.view.ViewGroup; -import android.view.ViewParent; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.openhippy.pool.BasePool.PoolType; @@ -35,7 +33,6 @@ import com.tencent.mtt.hippy.common.HippyArray; import com.tencent.mtt.hippy.dom.node.NodeProps; import com.tencent.mtt.hippy.modules.Promise; -import com.tencent.mtt.hippy.utils.UIThreadUtils; import com.tencent.mtt.hippy.views.custom.HippyCustomPropsController; import com.tencent.mtt.hippy.views.hippylist.HippyRecyclerViewController; import com.tencent.mtt.hippy.views.image.HippyImageViewController; @@ -57,7 +54,6 @@ import com.tencent.mtt.hippy.views.webview.HippyWebViewController; import com.tencent.renderer.NativeRender; import com.tencent.renderer.NativeRenderException; -import com.tencent.renderer.NativeRendererManager; import com.tencent.renderer.Renderer; import com.tencent.renderer.node.RenderNode; import com.tencent.renderer.node.VirtualNode; @@ -71,7 +67,7 @@ public class ControllerManager { @NonNull private final ControllerRegistry mControllerRegistry; @NonNull - private final ControllerUpdateManger, View> mControllerUpdateManger; + private final ControllerUpdateManger> mControllerUpdateManger; @NonNull private final Map> mPreCreateViewPools = new HashMap<>(); @NonNull diff --git a/renderer/native/android/src/main/java/com/tencent/mtt/hippy/uimanager/ControllerUpdateManger.java b/renderer/native/android/src/main/java/com/tencent/mtt/hippy/uimanager/ControllerUpdateManger.java index 3eb4e306e4d..2865c3862e9 100644 --- a/renderer/native/android/src/main/java/com/tencent/mtt/hippy/uimanager/ControllerUpdateManger.java +++ b/renderer/native/android/src/main/java/com/tencent/mtt/hippy/uimanager/ControllerUpdateManger.java @@ -38,7 +38,6 @@ import com.tencent.renderer.utils.PropertyUtils.PropertyMethodHolder; import com.tencent.renderer.node.RenderNode; -import java.lang.ref.WeakReference; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Collections; @@ -47,7 +46,7 @@ import java.util.Map; import java.util.Set; -public class ControllerUpdateManger { +public class ControllerUpdateManger { private static final Map, Map> sViewPropsMethodMap = new HashMap<>(); private static final Map sComponentPropsMethodMap = new HashMap<>(); @@ -191,12 +190,12 @@ private void invokePropMethod(@NonNull Object obj, @NonNull Object arg1, } } - private void handleCustomProps(T t, G g, @NonNull String key, + private void handleCustomProps(T t, @Nullable View g, @NonNull String key, @NonNull Map props) { - boolean hasCustomMethodHolder = false; - if (!(g instanceof View)) { + if (g == null) { return; } + boolean hasCustomMethodHolder = false; Object customProps = props.get(key); if (mCustomPropsController != null && mCustomPropsController instanceof HippyCustomPropsController) { @@ -214,11 +213,11 @@ private void handleCustomProps(T t, G g, @NonNull String key, } if (!hasCustomMethodHolder && t instanceof HippyViewController) { //noinspection unchecked - ((HippyViewController) t).setCustomProp((View) g, key, customProps); + ((HippyViewController) t).setCustomProp(g, key, customProps); } } - protected void updateProps(@NonNull RenderNode node, @NonNull T controller, @Nullable G view, + protected void updateProps(@NonNull RenderNode node, @NonNull T controller, @Nullable View view, @Nullable Map props, boolean skipComponentProps) { if (props == null || props.isEmpty()) { return; @@ -238,18 +237,20 @@ protected void updateProps(@NonNull RenderNode node, @NonNull T controller, @Nul } PropertyMethodHolder methodHolder = methodHolderMap.get(key); if (methodHolder != null) { - Object arg = (view == null) ? node.createView(true) : view; - if (arg != null) { - invokePropMethod(controller, arg, props, key, methodHolder); + if (view == null) { + view = node.createView(true); + } + if (view != null) { + invokePropMethod(controller, view, props, key, methodHolder); } } else { // Background color is a property supported by both view and component, if the // host view of a node has already been created, we need to set this property // separately on the view, otherwise the background color setting for non // flattened elements will not take effect. - if (key.equals(NodeProps.BACKGROUND_COLOR) && view instanceof View + if (key.equals(NodeProps.BACKGROUND_COLOR) && view != null && !(view instanceof FlatViewGroup)) { - ((View) view).setBackgroundColor( + view.setBackgroundColor( MapUtils.getIntValue(props, NodeProps.BACKGROUND_COLOR, Color.TRANSPARENT)); } else if (!handleComponentProps(node, key, props, skipComponentProps)) {