Skip to content

Commit 8ba4b56

Browse files
authored
Eliminate setText call in applyNewStyles on Android (#608)
1 parent 08aec81 commit 8ba4b56

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

android/src/main/java/com/expensify/livemarkdown/MarkdownTextInputDecoratorView.java

+7-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import androidx.annotation.Nullable;
44

55
import android.content.Context;
6+
import android.text.Editable;
7+
import android.text.SpannableStringBuilder;
68
import android.text.TextWatcher;
79
import android.util.AttributeSet;
810

@@ -92,8 +94,11 @@ protected void setParserId(int parserId) {
9294
}
9395

9496
protected void applyNewStyles() {
95-
if (mReactEditText != null) {
96-
mReactEditText.setTextKeepState(mReactEditText.getText()); // trigger update
97+
if (mReactEditText != null && mMarkdownUtils != null) {
98+
Editable editable = mReactEditText.getText();
99+
if (editable instanceof SpannableStringBuilder ssb) {
100+
mMarkdownUtils.applyMarkdownFormatting(ssb);
101+
}
97102
}
98103
}
99104
}

0 commit comments

Comments
 (0)