mirror of
https://github.com/Myzel394/NumberHub.git
synced 2025-06-19 08:45:27 +02:00
Fix crash on chips scroll
This commit is contained in:
parent
7e6036f4ce
commit
75ed884611
@ -102,13 +102,14 @@ private fun LeftSideScreen(
|
|||||||
val chipsRowLazyListState = rememberLazyListState()
|
val chipsRowLazyListState = rememberLazyListState()
|
||||||
|
|
||||||
LaunchedEffect(uiState.unitFrom, uiState.shownUnitGroups) {
|
LaunchedEffect(uiState.unitFrom, uiState.shownUnitGroups) {
|
||||||
// TODO Scroll to initially selected unit group
|
|
||||||
if (uiState.unitFrom == null) return@LaunchedEffect
|
if (uiState.unitFrom == null) return@LaunchedEffect
|
||||||
updateUnitGroup(uiState.unitFrom.group)
|
updateUnitGroup(uiState.unitFrom.group)
|
||||||
|
|
||||||
val groupToSelect = uiState.shownUnitGroups.indexOf(uiState.unitFrom.group)
|
val groupToSelect = uiState.shownUnitGroups.indexOf(uiState.unitFrom.group)
|
||||||
if (groupToSelect > -1) {
|
if (groupToSelect > -1) {
|
||||||
chipsRowLazyListState.animateScrollToItem(groupToSelect)
|
kotlin.runCatching {
|
||||||
|
chipsRowLazyListState.animateScrollToItem(groupToSelect)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user