Composable Function

rememberNestedScrollInteropConnection

Create and remember the NestedScrollConnection that enables Nested Scroll Interop between a View parent that implements androidx.core.view.NestedScrollingParent3 and a Compose child.

ComposeInCooperatingViewNestedScrollInteropSample

@Sampled
@Composable
fun ComposeInCooperatingViewNestedScrollInteropSample() {
    val nestedSrollInterop = rememberNestedScrollInteropConnection()
    // Add the nested scroll connection to your top level @Composable element
    // using the nestedScroll modifier.
    LazyColumn(modifier = Modifier.nestedScroll(nestedSrollInterop)) {
        items(20) { item ->
            Box(
                modifier =
                    Modifier.padding(16.dp).height(56.dp).fillMaxWidth().background(Color.Gray),
                contentAlignment = Alignment.Center,
            ) {
                Text(item.toString())
            }
        }
    }
}
Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: