mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-04-02 08:58:23 +02:00
Avoids changing the position of the the list when the list updates.
This commit is contained in:
parent
a399aa0ddd
commit
3ba6f84a43
@ -78,15 +78,9 @@ fun ThreadFeedView(noteId: String, viewModel: FeedViewModel, accountViewModel: A
|
||||
}
|
||||
}
|
||||
is FeedState.Loaded -> {
|
||||
var noteIdPositionInThread by remember { mutableStateOf(0) }
|
||||
// only in the first transition
|
||||
LaunchedEffect(noteIdPositionInThread) {
|
||||
listState.animateScrollToItem(noteIdPositionInThread, 0)
|
||||
}
|
||||
|
||||
val notePosition = state.feed.value.filter { it.idHex == noteId}.firstOrNull()
|
||||
if (notePosition != null) {
|
||||
noteIdPositionInThread = state.feed.value.indexOf(notePosition)
|
||||
LaunchedEffect(noteId) {
|
||||
val noteForPosition = state.feed.value.filter { it.idHex == noteId}.firstOrNull()
|
||||
listState.animateScrollToItem(state.feed.value.indexOf(noteForPosition), 0)
|
||||
}
|
||||
|
||||
LazyColumn(
|
||||
|
Loading…
x
Reference in New Issue
Block a user