From 965195eb86544e026b22e246fcb11b092321983e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ska=C5=82ka?= Date: Mon, 22 Apr 2024 14:25:31 +0200 Subject: [PATCH] Fix cursor positioning on android on markdown style change --- .../expensify/livemarkdown/MarkdownTextInputDecoratorView.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/android/src/main/java/com/expensify/livemarkdown/MarkdownTextInputDecoratorView.java b/android/src/main/java/com/expensify/livemarkdown/MarkdownTextInputDecoratorView.java index 51361af3..99512ce2 100644 --- a/android/src/main/java/com/expensify/livemarkdown/MarkdownTextInputDecoratorView.java +++ b/android/src/main/java/com/expensify/livemarkdown/MarkdownTextInputDecoratorView.java @@ -79,7 +79,10 @@ protected void setMarkdownStyle(MarkdownStyle markdownStyle) { mMarkdownUtils.setMarkdownStyle(mMarkdownStyle); } if (mReactEditText != null) { + int selectionStart = mReactEditText.getSelectionStart(); + int selectionEnd = mReactEditText.getSelectionEnd(); mReactEditText.setText(mReactEditText.getText()); // trigger update + mReactEditText.setSelection(selectionStart, selectionEnd); } } }