Skip to content

Commit

Permalink
fix: log screen scroll behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
tien committed Jun 7, 2023
1 parent 44d9dbc commit a26c578
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.tien.piholeconnect.ui.screen.log
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.LazyListState
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.foundation.selection.selectable
import androidx.compose.material.BottomSheetScaffoldDefaults
Expand Down Expand Up @@ -111,9 +112,9 @@ fun LogScreen(viewModel: LogViewModel = viewModel(), actions: @Composable () ->
)
}


val logList = @Composable {
LazyColumn(state = lazyListState) {
@Composable
fun LogList(state: LazyListState = rememberLazyListState()) {
LazyColumn(state = state) {
if (viewModel.hasBeenLoaded) {
logs.forEachIndexed { index, log ->
item(key = index) {
Expand Down Expand Up @@ -161,7 +162,7 @@ fun LogScreen(viewModel: LogViewModel = viewModel(), actions: @Composable () ->
actions()
}
}) {
logList()
LogList()
}
}
},
Expand Down Expand Up @@ -250,7 +251,7 @@ fun LogScreen(viewModel: LogViewModel = viewModel(), actions: @Composable () ->
}
}
Divider()
logList()
LogList(state = lazyListState)
}
}
})
Expand Down

0 comments on commit a26c578

Please sign in to comment.