From 2fb7ebfb7b6070864414625d6a5abfe37c363732 Mon Sep 17 00:00:00 2001 From: Denis Koroskin Date: Mon, 11 Jan 2016 18:06:45 -0800 Subject: [PATCH] Reset NodeRegion when a node gets mounted to a View Summary: Small optimization. Once we mount a Node to a View, its NodeRegion is not used anymore with RCTText being an exception, but it will correct itself automatically upon updateNodeRegion call. This patch allows the dead object to get garbage collected. Reviewed By: ahmedre Differential Revision: D2816331 --- .../src/main/java/com/facebook/react/flat/FlatShadowNode.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ReactAndroid/src/main/java/com/facebook/react/flat/FlatShadowNode.java b/ReactAndroid/src/main/java/com/facebook/react/flat/FlatShadowNode.java index 82c540c46..058d6e476 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/flat/FlatShadowNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/flat/FlatShadowNode.java @@ -263,6 +263,9 @@ import com.facebook.react.uimanager.ViewProps; if (getParent() != null) { invalidate(); } + + // reset NodeRegion to allow it getting garbage-collected + mNodeRegion = NodeRegion.EMPTY; } }