diff --git a/app/src/main/java/eu/kanade/presentation/library/components/LibraryTabs.kt b/app/src/main/java/eu/kanade/presentation/library/components/LibraryTabs.kt index 1904d39c2..a3d48d404 100644 --- a/app/src/main/java/eu/kanade/presentation/library/components/LibraryTabs.kt +++ b/app/src/main/java/eu/kanade/presentation/library/components/LibraryTabs.kt @@ -21,11 +21,12 @@ internal fun LibraryTabs( getNumberOfMangaForCategory: (Category) -> Int?, onTabItemClick: (Int) -> Unit, ) { + val currentPageIndex = pagerState.currentPage.coerceAtMost(categories.lastIndex) Column( modifier = Modifier.zIndex(1f), ) { PrimaryScrollableTabRow( - selectedTabIndex = pagerState.currentPage, + selectedTabIndex = currentPageIndex, edgePadding = 0.dp, // TODO: use default when width is fixed upstream // https://issuetracker.google.com/issues/242879624 @@ -33,7 +34,7 @@ internal fun LibraryTabs( ) { categories.forEachIndexed { index, category -> Tab( - selected = pagerState.currentPage == index, + selected = currentPageIndex == index, onClick = { onTabItemClick(index) }, text = { TabText(