mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-10-06 19:53:08 +00:00
feat: keep Public Chats scrolled to top when new top items arrive
When the first item of either the pinned or unpinned block changes, animate-scroll back to index 0 if the user was at or near the very top. This mirrors the pattern from ChatFeedView so a new chat bubbling up doesn't leave the user one row below it.
This commit is contained in:
+7
@@ -35,6 +35,7 @@ import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.material3.HorizontalDivider
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Alignment
|
||||
@@ -77,6 +78,12 @@ fun PublicChatsFeedLoaded(
|
||||
items.list.filter { it.idHex !in followedSet }
|
||||
}
|
||||
|
||||
LaunchedEffect(pinned.firstOrNull()?.idHex, unpinned.firstOrNull()?.idHex) {
|
||||
if (listState.firstVisibleItemIndex <= 1) {
|
||||
listState.animateScrollToItem(0)
|
||||
}
|
||||
}
|
||||
|
||||
LazyColumn(
|
||||
contentPadding = rememberFeedContentPadding(FeedPadding),
|
||||
state = listState,
|
||||
|
||||
Reference in New Issue
Block a user