voyager icon indicating copy to clipboard operation
voyager copied to clipboard

How to hide bottom tab bar at specific screens?

Open chihirooooooooo opened this issue 1 year ago • 3 comments

I have bottom tab bar at an app, but I want to hide it at specific screes. How to implement that?

chihirooooooooo avatar Nov 22 '23 20:11 chihirooooooooo

Has anyone found any solution for this case?

ArleyPereira avatar May 30 '24 00:05 ArleyPereira

You can use Nested Navigator, as mentioned in this issue: https://github.com/adrielcafe/voyager/issues/204.

To get the root, I implemented it like this:

fun findRootNavigator(
    currentNavigator: Navigator,
    depth: Int
): Navigator {
    return if (depth == 0 || currentNavigator.parent == null) {
        currentNavigator
    } else {
        return findRootNavigator(
            currentNavigator = currentNavigator.parent!!,
            depth = depth - 1
        )
    }
}
val currentNavigator = LocalNavigator.currentOrThrow
        val targetNavigator = findRootNavigator(
            currentNavigator = currentNavigator,
            depth = 2
        )
targetNavigator.push(
                            item = DetailsScreen()
                        )

Egi10 avatar Aug 10 '24 12:08 Egi10