androidx.compose.ui.input.nestedscroll

nestedScroll

Function · from org.jetbrains.compose.ui:ui:1.12.2

No hand-written docs yet.

Modify element to make it participate in the nested scrolling hierarchy.

Parameters

fun Modifier.nestedScroll(
    connection: NestedScrollConnection,
    dispatcher: NestedScrollDispatcher? = null,
): Modifier

connection: NestedScrollConnectionRequired

connection to the nested scroll system to participate in the event chaining, receiving events when scrollable descendant is being scrolled.

dispatcher: NestedScrollDispatcher?Optional

Default: null

object to be attached to the nested scroll system on which dispatch* methods can be called to notify ancestors within nested scroll system about scrolling happening

Library docs

Modify element to make it participate in the nested scrolling hierarchy.

There are two ways to participate in the nested scroll: as a scrolling child by dispatching scrolling events via NestedScrollDispatcher to the nested scroll chain; and as a member of nested scroll chain by providing NestedScrollConnection, which will be called when another nested scrolling child below dispatches scrolling events.

It's mandatory to participate as a NestedScrollConnection in the chain, but dispatching scrolling events is optional since there are cases where an element wants to participate in nested scrolling without being directly scrollable.

Here's the collapsing toolbar example that participates in a chain, but doesn't dispatch: