diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java index 6959c275f..2cadd153c 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java @@ -77,7 +77,7 @@ public class FabricUIManager implements UIManager { ViewManager viewManager = mViewManagerRegistry.get(viewName); ReactShadowNode node = viewManager.createShadowNodeInstance(mReactApplicationContext); ReactShadowNode rootNode = getRootNode(rootTag); - node.setRootNode(rootNode); + node.setRootTag(rootNode.getReactTag()); node.setViewClassName(viewName); node.setReactTag(reactTag); node.setThemedContext(rootNode.getThemedContext()); diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyOptimizer.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyOptimizer.java index de23eeaa1..b65627798 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyOptimizer.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyOptimizer.java @@ -407,7 +407,7 @@ public class NativeViewHierarchyOptimizer { // Create the view since it doesn't exist in the native hierarchy yet mUIViewOperationQueue.enqueueCreateView( - node.getRootNode().getThemedContext(), + node.getThemedContext(), node.getReactTag(), node.getViewClass(), props); diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactShadowNode.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactShadowNode.java index dbf64b135..7790a49dd 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactShadowNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactShadowNode.java @@ -139,9 +139,9 @@ public interface ReactShadowNode { void setReactTag(int reactTag); - T getRootNode(); + int getRootTag(); - void setRootNode(T rootNode); + void setRootTag(int rootTag); void setViewClassName(String viewClassName); diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactShadowNodeImpl.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactShadowNodeImpl.java index 5f4ad868f..e6b4a9012 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactShadowNodeImpl.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactShadowNodeImpl.java @@ -78,7 +78,6 @@ public class ReactShadowNodeImpl implements ReactShadowNode private int mReactTag; private @Nullable String mViewClassName; - private @Nullable ReactShadowNodeImpl mRootNode; private int mRootTag; private @Nullable ThemedReactContext mThemedContext; private boolean mShouldNotifyOnLayout; @@ -118,7 +117,6 @@ public class ReactShadowNodeImpl implements ReactShadowNode mReactTag = original.mReactTag; mRootTag = original.mRootTag; mViewClassName = original.mViewClassName; - mRootNode = original.mRootNode; mThemedContext = original.mThemedContext; mShouldNotifyOnLayout = original.mShouldNotifyOnLayout; mNodeUpdated = original.mNodeUpdated; @@ -493,13 +491,14 @@ public class ReactShadowNodeImpl implements ReactShadowNode } @Override - public final ReactShadowNodeImpl getRootNode() { - return Assertions.assertNotNull(mRootNode); + public final int getRootTag() { + Assertions.assertCondition(mRootTag != 0); + return mRootTag; } @Override - public final void setRootNode(ReactShadowNodeImpl rootNode) { - mRootNode = rootNode; + public final void setRootTag(int rootTag) { + mRootTag = rootTag; } @Override diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIImplementation.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIImplementation.java index f33ab6057..186a4d435 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIImplementation.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIImplementation.java @@ -279,7 +279,7 @@ public class UIImplementation { Assertions.assertNotNull(rootNode, "Root node with tag " + rootViewTag + " doesn't exist"); cssNode.setReactTag(tag); cssNode.setViewClassName(className); - cssNode.setRootNode(rootNode); + cssNode.setRootTag(rootNode.getReactTag()); cssNode.setThemedContext(rootNode.getThemedContext()); mShadowNodeRegistry.addNode(cssNode); @@ -1008,7 +1008,7 @@ public class UIImplementation { ReactShadowNode node = resolveShadowNode(reactTag); int rootTag = 0; if (node != null) { - rootTag = node.getRootNode().getReactTag(); + rootTag = node.getRootTag(); } else { FLog.w( ReactConstants.TAG,