diff --git a/app/src/main/kotlin/io/flamenet/messenger/app/MainActivity.kt b/app/src/main/kotlin/io/flamenet/messenger/app/MainActivity.kt index 4d76c92..2364bf2 100644 --- a/app/src/main/kotlin/io/flamenet/messenger/app/MainActivity.kt +++ b/app/src/main/kotlin/io/flamenet/messenger/app/MainActivity.kt @@ -95,11 +95,38 @@ private fun Root(model: MessengerViewModel = viewModel()) { if (chat != null) { ChatScreen(model, chat, current.error, current.buddies) } else { - when (current.screen) { - MessengerViewModel.Phase.Screen.CONTACTS -> SignedIn(model, current) - MessengerViewModel.Phase.Screen.NOTIFICATIONS -> - NotificationsScreen(model, current) - MessengerViewModel.Phase.Screen.ACCOUNT -> AccountScreen(model, current) + // 🔴 **The content area is weighted, and the tab bar is + // not.** These used to be plain siblings, so the tab bar + // sat immediately under whatever the screen had drawn: + // near the TOP of an empty Alerts tab, and pushed clean + // OFF the bottom by the Account tab, which is taller + // than the screen. Account also could not scroll, so the + // sign-out explanation was unreadable and there was no + // way back to another tab. + // + // ⚠️ Only the screens WITHOUT a lazy list may scroll. + // Contacts owns a LazyColumn, and a lazy list inside a + // vertically scrolling Column is measured with infinite + // height and crashes outright. + Column( + modifier = Modifier + .weight(1f) + .then( + if (current.screen == MessengerViewModel.Phase.Screen.CONTACTS) { + Modifier + } else { + Modifier.verticalScroll(rememberScrollState()) + } + ), + verticalArrangement = Arrangement.spacedBy(12.dp), + ) { + when (current.screen) { + MessengerViewModel.Phase.Screen.CONTACTS -> SignedIn(model, current) + MessengerViewModel.Phase.Screen.NOTIFICATIONS -> + NotificationsScreen(model, current) + MessengerViewModel.Phase.Screen.ACCOUNT -> + AccountScreen(model, current) + } } BottomNav(model, current) }