diff --git a/ReactCommon/fabric/mounting/stubs/StubViewTree.cpp b/ReactCommon/fabric/mounting/stubs/StubViewTree.cpp index a6152c0840..72ead4695c 100644 --- a/ReactCommon/fabric/mounting/stubs/StubViewTree.cpp +++ b/ReactCommon/fabric/mounting/stubs/StubViewTree.cpp @@ -11,9 +11,14 @@ namespace react { StubViewTree::StubViewTree(ShadowView const &shadowView) { auto view = std::make_shared(); view->update(shadowView); + rootTag = shadowView.tag; registry[shadowView.tag] = view; } +StubView const &StubViewTree::getRootStubView() const { + return *registry.at(rootTag); +} + void StubViewTree::mutate(ShadowViewMutationList const &mutations) { for (auto const &mutation : mutations) { switch (mutation.type) { diff --git a/ReactCommon/fabric/mounting/stubs/StubViewTree.h b/ReactCommon/fabric/mounting/stubs/StubViewTree.h index 59f112b895..4fc70016dd 100644 --- a/ReactCommon/fabric/mounting/stubs/StubViewTree.h +++ b/ReactCommon/fabric/mounting/stubs/StubViewTree.h @@ -21,6 +21,9 @@ class StubViewTree { void mutate(ShadowViewMutationList const &mutations); + StubView const &getRootStubView() const; + + Tag rootTag; std::unordered_map registry{}; };