Coder Social home page Coder Social logo

dawindergill / bottomtabnavigation-jetpackcompose Goto Github PK

View Code? Open in Web Editor NEW
9.0 1.0 1.0 231 KB

This demo project demonstrates the implementation of bottom tab navigation, showcasing a UI with multiple screens accessible through a bottom navigation bar. It provides a practical example for developers to learn and apply this navigation pattern in their own projects.

Home Page: https://medium.com/@dawinderapps/exploring-bottom-tab-navigation-in-jetpack-compose-a-hands-on-tutorial-fc44ca6217b0

Kotlin 100.00%
android-application android-architecture android-sdk android-ui bottom-navigation bottombar bottomnavigationview jetpack jetpack-compose jetpack-navigation

bottomtabnavigation-jetpackcompose's Issues

Alternative Approach

Hi , When i was adapting this code for my app i faced an issue with NavigationScreens.kt , basically it was a navigation related exception error .

I solved it by using my equivalent of NavigationScreens() inside of MainActivity instead of MainScreen() . (i kept the bottom bar within the NavigationScreens() which was earlier in MainScreen()).

@SuppressLint("UnusedMaterial3ScaffoldPaddingParameter")
@Composable
fun NavigationScreens() {
    val navController = rememberNavController()
    Scaffold(bottomBar = {
        BottomAppBar { BottomNavigationBar(navController = navController) }
    }) {
    }
 NavHost(navController = navController, startDestination = NavItem.Home.path) {

           composable(NavItem.Home.path){
               HomeScreen(navController = navController)
           }
}

I think it would be a better approach as we are directly utilizing our Navigation at first instance which itself would start the homeScreen as intended . MainScreen could be removed and its components could be kept directly inside the NavigationScreens()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.