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

Nested Screen in Bottom Navigation #421

Open
pankaj1920 opened this issue May 20, 2024 · 0 comments
Open

Nested Screen in Bottom Navigation #421

pankaj1920 opened this issue May 20, 2024 · 0 comments

Comments

@pankaj1920
Copy link

this is my bottom navigation

class HomePage : Screen {
@composable
override fun Content() {
Surface {
TabNavigator(tab = HomeScreen) {
Scaffold(

                bottomBar = {
                    BottomNavigation {
                        TabNavigationItem(tab = HomeScreen)
                        TabNavigationItem(tab = BookmarkScreen)
                        TabNavigationItem(tab = ProfileScreen)
                    }
                }
            ) {
                Column(modifier = Modifier.padding(it)) {
                    CurrentTab()
                }
            }
        }
    }
}

}

@composable
fun RowScope.TabNavigationItem(tab: Tab) {
val tabNavigator = LocalTabNavigator.current
BottomNavigationItem(selected = tabNavigator.current == tab,
onClick = {
tabNavigator.current = tab
}, icon = {
Icon(painter = tab.options.icon!!, contentDescription = tab.options.title)
})
}

This is my HomeScreen

object HomeScreen :Tab{

override val options: TabOptions
    @Composable
    get() {
        val title ="Home"
        val icon = rememberVectorPainter(Icons.Default.Home)
        return remember {
            TabOptions(0u,"Home",icon)

        }
    }

@Composable
override fun Content() { 

      val navigator = LocalNavigator.currentOrThrow 

        RedButton(
                    text = rightBtnText,
                    onClick = {
                        navigator.push(ProductDetailScreen(id=2)
                    },
                    modifier = Modifier.weight(1f).height(40.dp)
                )    }

}

so when i navigate from HomeScreen to ProductDetail Screen bottom navigation is not visible. i want to make bottom navigation visible in ProductDetail Screen and if i navigate from ProdutDetailScreen to other Screen in that case also Bottom navigation show be visible and In bottom navigation home icon shoud be selected.

Is there any way to achive it

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

1 participant