From 3d6464d0e1f91481cee1ee325dc9804e1aabeac5 Mon Sep 17 00:00:00 2001 From: Denis Koroskin Date: Mon, 4 Jan 2016 16:09:39 -0800 Subject: [PATCH] Properly mark root shadow node as mounting to a View Summary: RootFlatShadowNode always mounts to a (top-level) View but was never marked as one that mounts to a View. This diff fixes it. Nothing in the code relied on it being marked as mounting to a View, so it worked fine. A follow up path that implements UIImplementation.measure() for nodes that don't mount to a View goes up until it finds first mounting node, and it was crashing with NPE because it tried to access RootFlatShadowNode's parent (and there isn't one). Reviewed By: sriramramani Differential Revision: D2800818 --- .../java/com/facebook/react/flat/FlatRootShadowNode.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ReactAndroid/src/main/java/com/facebook/react/flat/FlatRootShadowNode.java b/ReactAndroid/src/main/java/com/facebook/react/flat/FlatRootShadowNode.java index 942b59aff..6db411c60 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/flat/FlatRootShadowNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/flat/FlatRootShadowNode.java @@ -14,6 +14,11 @@ package com.facebook.react.flat; */ /* package */ final class FlatRootShadowNode extends FlatShadowNode { + /* package */ FlatRootShadowNode() { + forceMountToView(); + signalBackingViewIsCreated(); + } + private boolean mIsUpdated; /**