Skip to content

Commit 4f670d8

Browse files
committed
scroll log to bottom.
1 parent 0384644 commit 4f670d8

File tree

1 file changed

+9
-1
lines changed
  • mobile/src/main/java/com/windscribe/mobile/ui/preferences/debug

1 file changed

+9
-1
lines changed

mobile/src/main/java/com/windscribe/mobile/ui/preferences/debug/DebugScreen.kt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ import androidx.compose.foundation.layout.Spacer
66
import androidx.compose.foundation.layout.height
77
import androidx.compose.foundation.layout.padding
88
import androidx.compose.foundation.lazy.LazyColumn
9+
import androidx.compose.foundation.lazy.rememberLazyListState
910
import androidx.compose.material3.MaterialTheme
1011
import androidx.compose.material3.Text
1112
import androidx.compose.runtime.Composable
13+
import androidx.compose.runtime.LaunchedEffect
1214
import androidx.compose.runtime.collectAsState
1315
import androidx.compose.runtime.getValue
1416
import androidx.compose.runtime.mutableStateOf
@@ -40,7 +42,13 @@ fun DebugScreen(viewModel: DebugViewModel? = null) {
4042
navController.popBackStack()
4143
}
4244
Spacer(modifier = Modifier.height(20.dp))
43-
LazyColumn {
45+
val listState = rememberLazyListState()
46+
LaunchedEffect(debugLog.size) {
47+
if (debugLog.isNotEmpty()) {
48+
listState.scrollToItem(debugLog.size - 1)
49+
}
50+
}
51+
LazyColumn(state = listState) {
4452
items(debugLog.size) {
4553
Text(
4654
debugLog[it],

0 commit comments

Comments
 (0)