Skip to content

Instantly share code, notes, and snippets.

View hristogochev's full-sized avatar

Hristo Gochev hristogochev

View GitHub Profile
@hristogochev
hristogochev / VoyagerSystemBars.kt
Created September 15, 2024 19:36
Voyager system bars workaround
// You can invoke LocalSystemBarsWindowInsets.current to get the correct window insets.
// You may need to pass this as a parameter to Scaffold if you use it, luckily Scaffold accepts custom WindowInsets.
val LocalSystemBarsWindowInsets = compositionLocalOf { WindowInsets(0.dp, 0.dp, 0.dp, 0.dp) }
// Wrap your main App function call with this one to access the system bars everywhere
@Composable
fun WithVoyagerSystemBars(content: @Composable () -> Unit) {
val systemBarsWindowInsets = WindowInsets.systemBars
CompositionLocalProvider(LocalSystemBarsWindowInsets provides systemBarsWindowInsets) {
@hristogochev
hristogochev / FirstTab.kt
Created April 29, 2024 00:43
Fix for Voyager TabNavigator not disposing of nested navigators
object FirstTab : Tab {
override var navigator: Navigator? = null
override val options: TabOptions
@Composable
get() = TODO("Not yet implemented")
@Composable
override fun Content() {
Navigator(FirstTabFirstScreen()) {
LaunchedEffect(it) {