Skip to content

Commit 2b8df3a

Browse files
authored
Merge pull request #41 from element-hq/android/fix-focus-issue-with-compose
[Android] Fix focus issue with compose
2 parents 260c67c + 5c08b89 commit 2b8df3a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

platforms/android/library/src/main/java/io/element/android/wysiwyg/EditorEditText.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import android.text.TextWatcher
2222
import android.util.AttributeSet
2323
import android.view.KeyEvent
2424
import android.view.MotionEvent
25+
import android.view.View
2526
import android.view.inputmethod.BaseInputConnection
2627
import android.view.inputmethod.EditorInfo
2728
import android.view.inputmethod.InputConnection
@@ -616,6 +617,11 @@ class EditorEditText : AppCompatEditText {
616617
textWatcher.removeChild(watcher)
617618
}
618619

620+
// This workaround is needed around compose to prevent the EditText focus from causing ANRs
621+
override fun focusSearch(direction: Int): View? {
622+
return null
623+
}
624+
619625
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
620626
// The size changed, so the cached positions for the code renderers won't match anymore
621627
inlineCodeBgHelper.clearCachedPositions()

0 commit comments

Comments
 (0)