Expose hash as part of text localdata

Summary: In this diff we expose the text local data hash to android, this will be used in the future to cache metadata when rendering text in android

Reviewed By: shergin

Differential Revision: D13161873

fbshipit-source-id: cd13a4beba75a3fe62ac9ff3def26f88e874834b
This commit is contained in:
David Vacca
2018-11-25 17:18:12 -08:00
committed by Facebook Github Bot
parent 3b4d6d5ef5
commit eec9e4a2f9
2 changed files with 3 additions and 0 deletions

View File

@@ -487,6 +487,8 @@ inline folly::dynamic toDynamic(const AttributedString &attributedString) {
fragments.push_back(dynamicFragment);
}
value("fragments", fragments);
value(
"hash", std::hash<facebook::react::AttributedString>{}(attributedString));
value("string", attributedString.getString());
return value;
}

View File

@@ -14,6 +14,7 @@ inline folly::dynamic toDynamic(const ParagraphLocalData &paragraphLocalData) {
folly::dynamic newLocalData = folly::dynamic::object();
newLocalData["attributedString"] =
toDynamic(paragraphLocalData.getAttributedString());
newLocalData["hash"] = newLocalData["attributedString"]["hash"];
return newLocalData;
}