diff --git a/packages/react-native/ReactCommon/react/renderer/mounting/tests/StateReconciliationTest.cpp b/packages/react-native/ReactCommon/react/renderer/mounting/tests/StateReconciliationTest.cpp index 9b74efad03ee0c..0e1882d254adcd 100644 --- a/packages/react-native/ReactCommon/react/renderer/mounting/tests/StateReconciliationTest.cpp +++ b/packages/react-native/ReactCommon/react/renderer/mounting/tests/StateReconciliationTest.cpp @@ -39,12 +39,18 @@ class DummyShadowTreeDelegate : public ShadowTreeDelegate { inline const ShadowNode* findDescendantNode( const ShadowNode& shadowNode, const ShadowNodeFamily& family) { - const ShadowNode* result = nullptr; - shadowNode.cloneTree(family, [&](const ShadowNode& oldShadowNode) { - result = &oldShadowNode; - return oldShadowNode.clone({}); - }); - return result; + if (&shadowNode.getFamily() == &family) { + return &shadowNode; + } + + for (auto childNode : shadowNode.getChildren()) { + auto descendant = findDescendantNode(*childNode, family); + if (descendant != nullptr) { + return descendant; + } + } + + return nullptr; } inline const ShadowNode* findDescendantNode(