From e082bca5e07dea222aaa8976347b747319a3da84 Mon Sep 17 00:00:00 2001 From: Isira Seneviratne Date: Sat, 10 Aug 2024 06:14:36 +0530 Subject: [PATCH] Use nested scroll modifier --- .../newpipe/ui/components/comment/CommentSection.kt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/ui/components/comment/CommentSection.kt b/app/src/main/java/org/schabi/newpipe/ui/components/comment/CommentSection.kt index 3f2a5a1ac..d41fb706a 100644 --- a/app/src/main/java/org/schabi/newpipe/ui/components/comment/CommentSection.kt +++ b/app/src/main/java/org/schabi/newpipe/ui/components/comment/CommentSection.kt @@ -17,6 +17,8 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.input.nestedscroll.nestedScroll +import androidx.compose.ui.platform.rememberNestedScrollInteropConnection import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.PreviewParameter @@ -45,10 +47,11 @@ fun CommentSection( Surface(color = MaterialTheme.colorScheme.background) { val comments = commentsFlow.collectAsLazyPagingItems() val itemCount by remember { derivedStateOf { comments.itemCount } } - val listState = rememberLazyListState() + val nestedScrollInterop = rememberNestedScrollInteropConnection() + val state = rememberLazyListState() - LazyColumnScrollbar(state = listState) { - LazyColumn(state = listState) { + LazyColumnScrollbar(state = state) { + LazyColumn(modifier = Modifier.nestedScroll(nestedScrollInterop), state = state) { if (parentComment != null) { item { CommentRepliesHeader(comment = parentComment)