Hey! I’m trying to replicate the scroll behavior o...
# compose
i
Hey! I’m trying to replicate the scroll behavior of a
LazyColumn
similar to what we see in the Gmail app: 1. Pull-to-refresh (PTR) works when the user drags the list with a finger ( works by default). 2. PTR indicator doesn’t show when the user scrolls using the mouse wheel ( achieved using
pointerInput
+
awaitPointerEventScope
to detect mouse input and disable PTR indicator). 3. Click-and-drag with a mouse should both scroll the list and trigger PTR — just like dragging with a finger ( currently stuck here). I tried adding a
draggable
modifier so users can click-and-drag to scroll, but: • There’s no momentum effect - if I scroll fast, the list stops instantly instead of continuing to glide. • It doesn’t trigger PTR either. Has anyone tackled something similar or knows how to achieve point (3)? Any hints or directions would be appreciated 🙏
Current state:
a
Some notes on what's happening here: pull-to-refresh works via nested scrolling, and in Compose scrolling by clicking-and-dragging is disabled for mouse specifically This differs from view behavior, where clicking-and-dragging with a mouse does scroll, but this is something we're taking a look at since clicking and dragging to scroll is not a common pattern on most desktop platforms - usually that will start selecting text instead. Is there a hard requirement to match View behavior here, where clicking and dragging with a mouse does scroll (and as a result, cause pull-to-refresh?)
i
I wouldn’t call it a hard requirement, but matching the View behavior would be the simplest way to enable pull-to-refresh for data displayed in a
LazyColumn
. From what I understand, on desktop it’s more common to have a dedicated refresh button in a toolbar instead of relying on pull-to-refresh gestures. The challenge is that updating this pattern consistently across the entire app would be quite costly, and it’s also unclear what the UX should be when a mouse is connected to a small-screen device where there’s no practical space for a refresh button. It’s possible my assumption about desktop UX isn’t entirely correct, and there may be a better pattern we should consider.