Skip to content

Commit

Permalink
Fix scroll to top button not hiding when switching sources
Browse files Browse the repository at this point in the history
  • Loading branch information
msasikanth committed Apr 18, 2024
1 parent ad6f7c7 commit 876538f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ internal fun HomeScreen(homePresenter: HomePresenter, modifier: Modifier = Modif

val listState = rememberLazyListState()
val featuredPostsPagerState = rememberPagerState(pageCount = { state.featuredPosts?.size ?: 0 })
val showScrollToTop by remember { derivedStateOf { listState.firstVisibleItemIndex > 1 } }

val strings = LocalStrings.current
val linkHandler = LocalLinkHandler.current
Expand Down Expand Up @@ -144,7 +145,6 @@ internal fun HomeScreen(homePresenter: HomePresenter, modifier: Modifier = Modif
val sheetPeekHeight =
BOTTOM_SHEET_PEEK_HEIGHT +
WindowInsets.navigationBars.asPaddingValues().calculateBottomPadding()
val showScrollToTop by remember { derivedStateOf { listState.firstVisibleItemIndex > 0 } }

BottomSheetScaffold(
modifier =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,20 @@ internal fun PostsList(
state = listState,
contentPadding = PaddingValues(top = topContentPadding, bottom = 128.dp)
) {
item {
FeaturedSection(
paddingValues = paddingValues,
pagerState = featuredPostsPagerState,
featuredPosts = featuredPosts,
featuredItemBlurEnabled = featuredItemBlurEnabled,
onItemClick = onPostClicked,
onPostBookmarkClick = onPostBookmarkClick,
onPostCommentsClick = onPostCommentsClick,
onPostSourceClick = onPostSourceClick,
onTogglePostReadClick = onTogglePostReadClick
)
if (featuredPosts.isNotEmpty()) {
item {
FeaturedSection(
paddingValues = paddingValues,
pagerState = featuredPostsPagerState,
featuredPosts = featuredPosts,
featuredItemBlurEnabled = featuredItemBlurEnabled,
onItemClick = onPostClicked,
onPostBookmarkClick = onPostBookmarkClick,
onPostCommentsClick = onPostCommentsClick,
onPostSourceClick = onPostSourceClick,
onTogglePostReadClick = onTogglePostReadClick
)
}
}

items(posts.itemCount) { index ->
Expand Down

0 comments on commit 876538f

Please sign in to comment.