Skip to content

Commit e082bca

Browse files
Use nested scroll modifier
1 parent f9dae90 commit e082bca

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

app/src/main/java/org/schabi/newpipe/ui/components/comment/CommentSection.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import androidx.compose.runtime.getValue
1717
import androidx.compose.runtime.remember
1818
import androidx.compose.ui.Alignment
1919
import androidx.compose.ui.Modifier
20+
import androidx.compose.ui.input.nestedscroll.nestedScroll
21+
import androidx.compose.ui.platform.rememberNestedScrollInteropConnection
2022
import androidx.compose.ui.res.stringResource
2123
import androidx.compose.ui.tooling.preview.Preview
2224
import androidx.compose.ui.tooling.preview.PreviewParameter
@@ -45,10 +47,11 @@ fun CommentSection(
4547
Surface(color = MaterialTheme.colorScheme.background) {
4648
val comments = commentsFlow.collectAsLazyPagingItems()
4749
val itemCount by remember { derivedStateOf { comments.itemCount } }
48-
val listState = rememberLazyListState()
50+
val nestedScrollInterop = rememberNestedScrollInteropConnection()
51+
val state = rememberLazyListState()
4952

50-
LazyColumnScrollbar(state = listState) {
51-
LazyColumn(state = listState) {
53+
LazyColumnScrollbar(state = state) {
54+
LazyColumn(modifier = Modifier.nestedScroll(nestedScrollInterop), state = state) {
5255
if (parentComment != null) {
5356
item {
5457
CommentRepliesHeader(comment = parentComment)

0 commit comments

Comments
 (0)