Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hide tab bar #204

Closed
aplha98 opened this issue Sep 16, 2023 · 11 comments
Closed

hide tab bar #204

aplha98 opened this issue Sep 16, 2023 · 11 comments

Comments

@aplha98
Copy link

aplha98 commented Sep 16, 2023

       TabNavigator(HomeTab) {
                Scaffold(
                    containerColor = Color.White,
                    bottomBar = {
                        Card(
                            shape = RoundedCornerShape(0.dp),
                            elevation = CardDefaults.cardElevation(
                                defaultElevation = 10.dp
                            )
                        ) { NavigationBar() }
                    }
                ) {
                    Column(modifier = Modifier.padding(it)) {
                        CurrentTab()
                    }
                }
            }

HomeTab
-> Profile

I want after clicking on button inside HomeTab to full view Profile with tab bar

@terrakok
Copy link
Contributor

Just call a navigation in outer navigator

@aplha98
Copy link
Author

aplha98 commented Sep 17, 2023

how can I select navigator

@terrakok
Copy link
Contributor

@aplha98
Copy link
Author

aplha98 commented Sep 18, 2023

how can I reach parent level 0 when I in level5

@terrakok
Copy link
Contributor

you can get parents until it is not null to achieve root

@aplha98
Copy link
Author

aplha98 commented Sep 18, 2023

how?

@terrakok
Copy link
Contributor

terrakok commented Sep 18, 2023

image

@shriharsha-srb
Copy link

How can I hide bottom navigation bar on scroll of a LazyColumn inside a HomeTab?

@terrakok
Copy link
Contributor

the question is not related to the Voyager. Try to ask on the StackOverflow

@shriharsha-srb
Copy link

Yes its here Stackoverflow link.

@blackwiz4rd
Copy link

One alternative if you use koin is to create an observable on the bottomBar composable function:

val bottomBarVisibilityManager: BottomBarVisibilityManager = koinInject()
var isBottomBarVisible = remember { mutableStateOf(true) }
bottomBarVisibilityManager.observeBottomBarVisibility { isVisible ->
    isBottomBarVisible.value = isVisible
}
if (isBottomBarVisible.value) {YourBottomBar()}
class BottomBarVisibilityManagerImpl : BottomBarVisibilityManager {

    private val _bottomBarVisible = MutableStateFlow(true)
    override val bottomBarVisible: StateFlow<Boolean> = _bottomBarVisible.asStateFlow()

    private val coroutineScope = CoroutineScope(Dispatchers.Main) // Use Dispatchers.Main for UI updates

    override fun setBottomBarVisibility(visible: Boolean) {
        _bottomBarVisible.value = visible
    }

    override fun isBottomBarVisible(): Boolean {
        return _bottomBarVisible.value
    }

    override fun observeBottomBarVisibility(observer: (Boolean) -> Unit) {
        coroutineScope.launch {
            bottomBarVisible.collect { isVisible ->
                observer(isVisible)
            }
        }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants