diff --git a/ReactCommon/fabric/uimanager/ShadowTree.cpp b/ReactCommon/fabric/uimanager/ShadowTree.cpp index f61fa9605c9..36112f6567e 100644 --- a/ReactCommon/fabric/uimanager/ShadowTree.cpp +++ b/ReactCommon/fabric/uimanager/ShadowTree.cpp @@ -50,11 +50,6 @@ Tag ShadowTree::getSurfaceId() const { return surfaceId_; } -SharedRootShadowNode ShadowTree::getRootShadowNode() const { - std::shared_lock lock(commitMutex_); - return rootShadowNode_; -} - bool ShadowTree::commit( std::function transaction, diff --git a/ReactCommon/fabric/uimanager/ShadowTree.h b/ReactCommon/fabric/uimanager/ShadowTree.h index 68e1a9ea1fc..9bec4ae3313 100644 --- a/ReactCommon/fabric/uimanager/ShadowTree.h +++ b/ReactCommon/fabric/uimanager/ShadowTree.h @@ -54,11 +54,6 @@ class ShadowTree final { int attempts = 1, int *revision = nullptr) const; - /* - * Returns a root shadow node that represents the last committed three. - */ - SharedRootShadowNode getRootShadowNode() const; - #pragma mark - Delegate /* diff --git a/ReactCommon/fabric/uimanager/UIManager.cpp b/ReactCommon/fabric/uimanager/UIManager.cpp index 147d361dd26..33ba755446d 100644 --- a/ReactCommon/fabric/uimanager/UIManager.cpp +++ b/ReactCommon/fabric/uimanager/UIManager.cpp @@ -100,7 +100,10 @@ LayoutMetrics UIManager::getRelativeLayoutMetrics( if (!ancestorShadowNode) { shadowTreeRegistry_->visit( shadowNode.getRootTag(), [&](const ShadowTree &shadowTree) { - ancestorShadowNode = shadowTree.getRootShadowNode().get(); + shadowTree.commit([&](const SharedRootShadowNode &oldRootShadowNode) { + ancestorShadowNode = oldRootShadowNode.get(); + return nullptr; + }); }); }