Skip to content

Commit 7414dcc

Browse files
authored
fix(android): prevent scroll flicker in auto-grow mode by blocking scrollTo (#235)
1 parent adce6d9 commit 7414dcc

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

android/src/main/java/com/swmansion/enriched/markdown/input/EnrichedMarkdownInputView.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,16 @@ class EnrichedMarkdownInputView(
169169

170170
override fun performClick(): Boolean = super.performClick()
171171

172+
// In auto-grow mode (scrollEnabled=false) TextView's internal bringPointIntoView
173+
// scrolls content before Fabric has resized the view, causing a visible flicker.
174+
override fun scrollTo(
175+
x: Int,
176+
y: Int,
177+
) {
178+
if (!scrollEnabled) return
179+
super.scrollTo(x, y)
180+
}
181+
172182
override fun canScrollVertically(direction: Int): Boolean = scrollEnabled && super.canScrollVertically(direction)
173183

174184
override fun canScrollHorizontally(direction: Int): Boolean = scrollEnabled && super.canScrollHorizontally(direction)

0 commit comments

Comments
 (0)