From 2a469805355d9f5bd73e8b1b6b93cacb60fbce4e Mon Sep 17 00:00:00 2001 From: Joshua Gross Date: Thu, 5 Dec 2019 13:16:09 -0800 Subject: [PATCH] AttributedString equality: only check tags of parentShadowView; ShadowViews are never equal otherwise Summary: For future diffs, we need to check AttributedStrings for equality. It turns out that any time props or state change, two `parentShadowView`s will never be equal to each other, even if we'd consider them equal for our use-cases here for AttributedStrings. Just compare the tags instead of the whole object. NOTE: I don't have any strong opinions about how we should be comparing them. It just isn't working currently for AndroidTextInput. Comparing tags seems convenient and reasonably correct for now. Changelog: [Internal] Reviewed By: shergin Differential Revision: D18786004 fbshipit-source-id: 13c0e881cd8d2c2a207e8891309b3c9b880b827f --- ReactCommon/fabric/attributedstring/AttributedString.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ReactCommon/fabric/attributedstring/AttributedString.cpp b/ReactCommon/fabric/attributedstring/AttributedString.cpp index 974d214ea69..6bf2912e490 100644 --- a/ReactCommon/fabric/attributedstring/AttributedString.cpp +++ b/ReactCommon/fabric/attributedstring/AttributedString.cpp @@ -26,8 +26,8 @@ bool Fragment::isAttachment() const { } bool Fragment::operator==(const Fragment &rhs) const { - return std::tie(string, textAttributes, parentShadowView) == - std::tie(rhs.string, rhs.textAttributes, rhs.parentShadowView); + return std::tie(string, textAttributes, parentShadowView.tag) == + std::tie(rhs.string, rhs.textAttributes, rhs.parentShadowView.tag); } bool Fragment::operator!=(const Fragment &rhs) const {