hotwired / turbo-android

Android framework for making Turbo native apps
MIT License
423 stars 51 forks source link

Add `TurboSessionNavHostFragment` API documentation #194

Closed jayohms closed 6 months ago

lanke96 commented 2 years ago

Hi there! I am trying to make a bottom navigation bar, and the application crashed when I add app:navGraph="@navigation/nav_graph to the FragmentContainerView. The trace back takes me to some Turbo classes, so I assume that either Turbo is not compatible with the navgraph, or I am missing a configuration. I've been struggling with this for days, and I haven't come up with a solution. That happens when the MainActivity tries to inflate its layout setContentView(R.layout.activity_main) image

jayohms commented 2 years ago

I'm curious why you're trying to manually add a nav_graph to the FragmentContainerView? This approach isn't compatible the library, since turbo-android builds the navigation graph dynamically: https://github.com/hotwired/turbo-android/blob/main/turbo/src/main/kotlin/dev/hotwire/turbo/nav/TurboNavGraphBuilder.kt

I'll write up an example of using bottom navigation tabs with turbo-android soon, but I won't have time in the next week. For some pointers, see the discussion here: https://github.com/hotwired/turbo-android/issues/189

lanke96 commented 2 years ago

I'm curious why you're trying to manually add a nav_graph to the FragmentContainerView? This approach isn't compatible the library, since turbo-android builds the navigation graph dynamically: https://github.com/hotwired/turbo-android/blob/main/turbo/src/main/kotlin/dev/hotwire/turbo/nav/TurboNavGraphBuilder.kt

I'll write up an example of using bottom navigation tabs with turbo-android soon, but I won't have time in the next week. For some pointers, see the discussion here: #189

To be honest, I am still getting familiarized with the library and my first thought was to implement the navigation as I see it in the Android Documentation. I saw the issue you mentioned, but I was stubbornly trying to make the nav_graph work. I will see the issue again and try that approach.

Thanks for your comments!

tannakartikey commented 1 year ago

I'll write up an example of using bottom navigation tabs with turbo-android soon, but I won't have time in the next week. For some pointers, see the discussion here: https://github.com/hotwired/turbo-android/issues/189

Hey @jayohms Just wanted to know if you have written the example of using bottom navigation tabs. I could not find it on the repo. Thanks for turbo-android! :)

jayohms commented 6 months ago

Missing API documentation added here: https://github.com/hotwired/turbo-android/pull/313