From 4ae1a9bea89656e5214f6ebbdb6a8490b6b77a26 Mon Sep 17 00:00:00 2001 From: Joshua Gross Date: Wed, 31 Mar 2021 21:29:13 -0700 Subject: [PATCH] Do not check consistency of updated Virtual views Summary: This impacts Android only. It's not high-impact to check the consistency of these views and they can become "inconsistent" easily in a way that is not interesting or useful to us, since we handle "virtual" views differently on the platform. The need for these hacks should go away in the future if/when we account for virtual views in the differ, and stop sending redundant instructions entirely. Changelog: [Internal] Reviewed By: sammy-SC Differential Revision: D27407779 fbshipit-source-id: 01a7ea5106ed5d94b908de03a6a710cc6275018d --- .../react/renderer/mounting/StubViewTree.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/ReactCommon/react/renderer/mounting/StubViewTree.cpp b/ReactCommon/react/renderer/mounting/StubViewTree.cpp index 77be82e032e..0dafb5419d8 100644 --- a/ReactCommon/react/renderer/mounting/StubViewTree.cpp +++ b/ReactCommon/react/renderer/mounting/StubViewTree.cpp @@ -93,6 +93,10 @@ void StubViewTree::mutate(ShadowViewMutationList const &mutations) { childStubView->parentTag = parentTag; parentStubView->children.insert( parentStubView->children.begin() + mutation.index, childStubView); + } else { + auto childTag = mutation.newChildShadowView.tag; + auto childStubView = registry[childTag]; + childStubView->update(mutation.newChildShadowView); } break; } @@ -151,13 +155,15 @@ void StubViewTree::mutate(ShadowViewMutationList const &mutations) { registry.find(mutation.newChildShadowView.tag) != registry.end()); auto oldStubView = registry[mutation.newChildShadowView.tag]; react_native_assert(oldStubView->tag != 0); - if ((ShadowView)(*oldStubView) != mutation.oldChildShadowView) { - LOG(ERROR) - << "UPDATE mutation assertion failure: oldChildShadowView doesn't match oldStubView: [" - << mutation.oldChildShadowView.tag << "]"; + if (!mutation.mutatedViewIsVirtual()) { + if ((ShadowView)(*oldStubView) != mutation.oldChildShadowView) { + LOG(ERROR) + << "UPDATE mutation assertion failure: oldChildShadowView doesn't match oldStubView: [" + << mutation.oldChildShadowView.tag << "]"; + } + react_native_assert( + (ShadowView)(*oldStubView) == mutation.oldChildShadowView); } - react_native_assert( - (ShadowView)(*oldStubView) == mutation.oldChildShadowView); oldStubView->update(mutation.newChildShadowView); break; }