Skip to content

Commit

Permalink
textInput update
Browse files Browse the repository at this point in the history
  • Loading branch information
tarouboy committed Feb 17, 2021
1 parent e172caa commit b14fbf2
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -468,9 +468,9 @@ public int incrementAndGetEventCounter() {
}

public void maybeSetTextFromJS(ReactTextUpdate reactTextUpdate) {
mIsSettingTextFromJS = true;
maybeSetText(reactTextUpdate);
mIsSettingTextFromJS = false;
// mIsSettingTextFromJS = true;
// maybeSetText(reactTextUpdate);
// mIsSettingTextFromJS = false;
}

public void maybeSetTextFromState(ReactTextUpdate reactTextUpdate) {
Expand Down Expand Up @@ -502,10 +502,10 @@ public void maybeSetText(ReactTextUpdate reactTextUpdate) {
// current text need to be adapted to the new text. Since TextView#setText() will remove or
// reset some of these spans even if they are set directly, SpannableStringBuilder#replace() is
// used instead (this is also used by the keyboard implementation underneath the covers).
SpannableStringBuilder spannableStringBuilder =
new SpannableStringBuilder(reactTextUpdate.getText());
manageSpans(spannableStringBuilder);
mContainsImages = reactTextUpdate.containsImages();
// SpannableStringBuilder spannableStringBuilder =
// new SpannableStringBuilder(reactTextUpdate.getText());
// manageSpans(spannableStringBuilder);
// mContainsImages = reactTextUpdate.containsImages();

// When we update text, we trigger onChangeText code that will
// try to update state if the wrapper is available. Temporarily disable
Expand All @@ -517,10 +517,12 @@ public void maybeSetText(ReactTextUpdate reactTextUpdate) {
if (reactTextUpdate.getText().length() == 0) {
setText(null);
} else {
String updatedText = reactTextUpdate.getText().toString();
setText(updatedText);
// When we update text, we trigger onChangeText code that will
// try to update state if the wrapper is available. Temporarily disable
// to prevent an infinite loop.
getText().replace(0, length(), spannableStringBuilder);
//getText().replace(0, length(), spannableStringBuilder);
}
mDisableTextDiffing = false;

Expand Down

1 comment on commit b14fbf2

@tarouboy
Copy link
Owner Author

@tarouboy tarouboy commented on b14fbf2 Feb 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trying to improve facebook#20119

Please sign in to comment.