From a46bf35127ac575f4dd02505910e79cb10fc795e Mon Sep 17 00:00:00 2001 From: Rayen Sbai Date: Sun, 22 Nov 2026 13:37:42 +0100 Subject: [PATCH] fix(android): clip a list to its bounds so a pushed sticky row leaves with it A pinned sticky row pushed by the next header moved past the list's top edge and drew over the views above the list, about 22 dp of it on the example's React tab. Both pinned copies are children of the list view moved by a translation, and React Native parents do not clip their children. The list now clips its drawing to its bounds, as a ScrollView does on Android and the collection view does on iOS. --- android/src/main/java/me/sectiontn/flume/FlumeView.kt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/android/src/main/java/me/sectiontn/flume/FlumeView.kt b/android/src/main/java/me/sectiontn/flume/FlumeView.kt index 3bd9413..1226d6b 100644 --- a/android/src/main/java/me/sectiontn/flume/FlumeView.kt +++ b/android/src/main/java/me/sectiontn/flume/FlumeView.kt @@ -1,6 +1,7 @@ package me.sectiontn.flume import android.content.Context +import android.graphics.Canvas import android.view.MotionEvent import android.view.View import android.view.VelocityTracker @@ -781,6 +782,14 @@ class FlumeView(context: Context) : FrameLayout(context) { down.recycle() } + // A list clips to its bounds like a ScrollView, so a pinned copy pushed past the edge leaves the screen with it. + override fun dispatchDraw(canvas: Canvas) { + val saved = canvas.save() + canvas.clipRect(0, 0, width, height) + super.dispatchDraw(canvas) + canvas.restoreToCount(saved) + } + override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) { super.onSizeChanged(w, h, oldw, oldh) if (adapter.onViewportChanged(w, h, resources.configuration.fontScale)) sticky.refresh(force = true)