From 22c1032dbcea0b23fbc215caed72d9691e265f7a Mon Sep 17 00:00:00 2001 From: Samuel Susla Date: Tue, 11 Aug 2020 13:18:40 -0700 Subject: [PATCH] Fix text not being restored from state in TextInput Summary: Changelog: [internal] Restore text value from state when re-initialising RCTTextInputComponentView Reviewed By: shergin Differential Revision: D22844624 fbshipit-source-id: b47e3fe890793f8de429b637535d641262c42be2 --- .../ComponentViews/TextInput/RCTTextInputComponentView.mm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm b/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm index 6cf72777384..1a461aa93f9 100644 --- a/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm @@ -222,8 +222,13 @@ using namespace facebook::react; return; } + auto data = _state->getData(); + + if (!oldState) { + _mostRecentEventCount = _state->getData().mostRecentEventCount; + } + if (_mostRecentEventCount == _state->getData().mostRecentEventCount) { - auto data = _state->getData(); _comingFromJS = YES; [self _setAttributedString:RCTNSAttributedStringFromAttributedStringBox(data.attributedStringBox)]; _comingFromJS = NO;