From 871e14fd80de260d003af1471f6ef9280e1d5508 Mon Sep 17 00:00:00 2001 From: David Vacca Date: Thu, 27 Aug 2020 20:54:52 -0700 Subject: [PATCH] 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 --- .../components/androidtextinput/AndroidTextInputState.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputState.cpp b/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputState.cpp index 1568350799..6cb7b11561 100644 --- a/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputState.cpp +++ b/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputState.cpp @@ -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;