Fix initial render of RN Android TextInput

Summary:
This diff fixes the initial render of RN Android TextInput. The problem was that "attributedString" was not serialized until an event was sent from native side.

Changelog: [internal] internal

Reviewed By: JoshuaGross

Differential Revision: D23383969

fbshipit-source-id: 86601434b1fbaa9f712bdb79b013a1d004bc55a4
This commit is contained in:
David Vacca 2020-08-27 20:54:52 -07:00 коммит произвёл Facebook GitHub Bot
Родитель e60564215d
Коммит 871e14fd80
1 изменённых файлов: 2 добавлений и 4 удалений

Просмотреть файл

@ -18,10 +18,8 @@ folly::dynamic AndroidTextInputState::getDynamic() const {
// Java doesn't need all fields, so we don't pass them along.
folly::dynamic newState = folly::dynamic::object();
newState["mostRecentEventCount"] = mostRecentEventCount;
if (mostRecentEventCount != 0) {
newState["attributedString"] = toDynamic(attributedString);
newState["hash"] = newState["attributedString"]["hash"];
}
newState["attributedString"] = toDynamic(attributedString);
newState["hash"] = newState["attributedString"]["hash"];
newState["paragraphAttributes"] =
toDynamic(paragraphAttributes); // TODO: can we memoize this in Java?
return newState;