https://kotlinlang.org logo
Join Slack
Powered by
# compose-destinations
  • a

    annsofi

    10/25/2024, 11:42 AM
    👋 I'm working on migrating some stuff from old startForResult into compose destinations. If what I need a result back from is a system settings panel, is this Multi module result back case the best way forward?
    r
    • 2
    • 3
  • a

    Aseem Sharma

    11/07/2024, 1:15 PM
    Hi @Rafael Costa we were trying to use multiple DestinationNavHost for similar kind of scenario as mention in this issue: https://github.com/raamcosta/compose-destinations/issues/492
    r
    s
    • 3
    • 10
  • n

    Nizam

    11/21/2024, 2:32 PM
    Hi @Rafael Costa we are getting slow gradle build since ksp incremental processing is not working. Can you please help here https://github.com/raamcosta/compose-destinations/issues/702#issuecomment-2491370951
    r
    • 2
    • 10
  • i

    Ilias Goormans

    11/27/2024, 9:34 AM
    Hi @Rafael Costa, do you have a (crude) estimation when V2 will be production-ready?
    r
    • 2
    • 3
  • b

    Bekzod

    12/05/2024, 8:09 AM
    hi @Rafael Costa trying to navigate back with result. Applied serializable but did not work for some reason.
    Copy code
    @Destination
    @Composable
    fun AgentOrderWarehouseProductsScreen(
        warehouseId: Long,
        navController: DestinationsNavigator,
        editOrderConfirmationResultRecipient: ResultRecipient<AgentEditOrderConfirmationDialogDestination, DismissEditConfirmationEnum>,
        filterResultRecipient: ResultRecipient<AgentOrderProductsFilterBottomSheetDestination, FilterWarehouseProduct>,
        viewModel: AgentOrderWarehouseProductsViewModel = get()
    ) {
    and
    Copy code
    import kotlinx.serialization.Serializable
    
    @Serializable
    data class FilterWarehouseProduct(
        val productInStock: ProductInStock,
        val productSelectionType: ProductSelectionType
    )
    destinations:
    Copy code
    private fun ManualComposableCallsBuilder.agentOrderWarehouseProductsScreenDestination() {
        composable(AgentOrderWarehouseProductsScreenDestination) {
            AgentOrderWarehouseProductsScreen(
                navController = destinationsNavigator,
                warehouseId = navArgs.warehouseId,
                filterResultRecipient = resultRecipient<AgentOrderProductsFilterBottomSheetDestination, FilterWarehouseProduct>(),
                editOrderConfirmationResultRecipient = resultRecipient<AgentEditOrderConfirmationDialogDestination, DismissEditConfirmationEnum>()
            )
        }
    }
    error: ksp] com.ramcosta.composedestinations.codegen.commons.IllegalDestinationsSetup: Composable AgentOrderWarehouseProductsScreen, FilterWarehouseProduct: Result types must be one of: String, Long, Boolean, Float, Int, Parcelable, Serializable.
    Copy code
    @Destination(style = DestinationStyleBottomSheet::class)
    @Composable
    fun AgentOrderProductsFilterBottomSheet(
        productInStock: ProductInStock,
        productSelectionType: ProductSelectionType,
        resultBackNavigator: ResultBackNavigator<FilterWarehouseProduct>
    ) {
    and
    Copy code
    private fun ManualComposableCallsBuilder.agentFilterOrderBottomSheetDestination() {
        bottomSheetComposable(AgentOrderProductsFilterBottomSheetDestination) {
            AgentOrderProductsFilterBottomSheet(
                productInStock = navArgs.productInStock,
                productSelectionType = navArgs.productSelectionType,
                resultBackNavigator = resultBackNavigator()
            )
        }
    }
    initially it was not data class but pair, tried to change it to data class but not fixed. it stopped working after I updated to the latest version. raamcostaNavitagion = "1.11.7" it used to be "1.8.33-beta". it is interesting to note that when I tried with @Parcelize it worked but here I cannot do it since FilterWarehouseProduct is in commonMain. I need that data class in Swift Ui
    r
    • 2
    • 8
  • s

    Suhaib Kazi

    12/09/2024, 12:39 PM
    Hey @Rafael Costa I have some NavArgs data class in a module different from my app module When trying to use the data class like this
    navArgs = ProfileScreenNavArgs::class
    It says
    Copy code
    [ksp] com.ramcosta.composedestinations.codegen.commons.IllegalDestinationsSetup: Cannot detect default value for navigation argument 'serverID' because we don't have access to source code. Nav argument classes from other modules with default values are not supported!
    r
    • 2
    • 5
  • d

    David

    12/12/2024, 8:59 AM
    Hey @Rafael Costa! Just made a small PR to update some of the dependencies. 😊 Would you mind creating a new release? I'm longing for Navigation 2.8.5 since it fixes a problem in prod
    🙏 1
    r
    s
    • 3
    • 4
  • s

    Suhaib Kazi

    12/13/2024, 10:27 AM
    I have query I have a NavGraph Which i want to be part of 2 different NavGraphs or NavHostGraphs Is this possible? @Rafael Costa
  • s

    Suhaib Kazi

    12/18/2024, 12:49 PM
    Would there be a way to add/override the wrappers in a feature module and imported in the main graph as an entire feature graph So that we can add/override whatever wrapper we want on an individual screen level
    r
    • 2
    • 21
  • p

    Patrick Cavanagh

    12/18/2024, 5:50 PM
    Heyo 👋 Is there any movement on getting closer to the final v2/ v2.1 release? Don't mean to nag but am quite keen to get this PR merged to hopefully help support a migration to KSP 2 🙏
    ❤️ 1
    r
    d
    • 3
    • 7
  • s

    Suhaib Kazi

    12/20/2024, 12:45 PM
    I have another question @Rafael Costa I have a navGraph on the App side with no destinations of its own! And i want to attach external destinations from another module But the issue im facing is that no code is being generated for the app graph which doesnt actually have its own app-side destinations, only lib side
    r
    • 2
    • 18
  • m

    Mini

    01/09/2025, 2:20 PM
    Is there a way to get destination argument names from the generated code? E.g. I'd like to access a key in the savedStateHandle retrieved in a ViewModel without having to hardcode the argument name
    Copy code
    fun SomeDestination(val arg1: Long, val someString: String) {}
    class MyViewModel(savedStateHandle: SavedStateHandle) : ViewModel() {
        val someString = savedStateHandle.get(SomeDestinationArgumentKeys.SomeString)
    }
    r
    • 2
    • 6
  • m

    Mini

    01/28/2025, 11:21 AM
    Seems like the answer is no, but; is there a way to navigate to multiple bottomsheets without having each new one replacing the previous? To a screen from a bottomsheet, without having the bottomsheet disappear from the backstack?
    s
    • 2
    • 1
  • r

    Ryan

    01/28/2025, 6:45 PM
    hey @Rafael Costa I've got a question with how I might use specific animation for bottom bar navigations vs. pushing to an item. I currently have a single navigation graph with all of my destinations with the bottom bar similar to your example:
    Copy code
    BottomBarItem.entries.forEach { destination ->
              val isCurrentDestOnBackStack by
                navController.isRouteOnBackStackAsState(destination.direction)
              NavigationBarItem(
                selected = isCurrentDestOnBackStack,
                onClick = {
                  if (isCurrentDestOnBackStack) {
                    // When we click again on a bottom bar item and it was already selected
                    // we want to pop the back stack until the initial destination of this bottom bar
                    // item
                    navigator.popBackStack(destination.direction, false)
                    return@NavigationBarItem
                  }
    
                  navigator.navigate(destination.direction) {
                    // Pop up to the root of the graph to
                    // avoid building up a large stack of destinations
                    // on the back stack as users select items
                    popUpTo(NavGraphs.root) { saveState = true }
    
                    // Avoid multiple copies of the same destination when
                    // reselecting the same item
                    launchSingleTop = true
                    // Restore state when reselecting a previously selected item
                    restoreState = true
                  }
                },
                // ...
              )
            }
          }
    Is there a way within a subclassed
    DestinationStyle.Animated()
    to see whether navigation is occurring from this bottom bar or is there a way through nested navigation graphs to achieve this (seems heavy handed for animation)?
    d
    r
    • 3
    • 5
  • i

    Ilia Kazantsev

    03/23/2025, 6:20 PM
    Hello, guys. First of all, thank you for such a great piece of software. I enjoy using it - makes the code much more reliable and easier to support. I have a question that has been strangling me for the past week. I have a multi-module project with feature graphs and all of that stuff - it's set up according to the library documentation. The issue is that I want to add a ModalBottomSheetLayout and use bottom sheet destinations within a feature graph. However, from what I’ve seen, the official approach suggests placing the ModalBottomSheetLayout at the root of a whole composable hierarchy. Is there any way to include the ModalBottomSheetLayout at the root of a feature graph instead? And would that even be considered a good approach? I am asking because I need to customize appearance for bottom sheets in each feature and this looks to me as the easiest approach for that task.
    r
    d
    • 3
    • 5
  • a

    Alex Char

    03/24/2025, 12:54 PM
    Hey everyone, I have a question about retaining state and managing multiple backstacks (multi module project) in v2. I'll share my setup in this thread—can anyone help me understand why the state isn't being restored for my screens?
    • 1
    • 2
  • r

    Robert C

    04/02/2025, 9:27 AM
    Hello, im trying to share an object that will live within 2 screen destinations, any clue how i can achieve that? i was trying to use dependenciesContainerBuilder like
    Copy code
    dependenciesContainerBuilder = {
    navGraph(SomeNavGraph){
    dependency(SomeObject())
    }
    and then im trying to inject this by
    Copy code
    ScreenA(
    ...
    someObject: SomeObject
    )
    
    ScreenB(
    ...
    someObject: SomeObject
    )
    where SomeNavGraph contains 2 destinations, im using Koin in the project object is getting injected but these are 2 different objects in both of the screens both screens belong to nested SomeNavGraph is this possible for non viewmodel objects?
    m
    • 2
    • 5
  • t

    Thomas Richtsfeld

    04/15/2025, 5:14 PM
    Hey there 👋 (using V2) I am trying to open a composable/screen from an app with a bottom nav bar. Unfortunately I can't manage to open it on top of the whole screen including the bottom bar (bottom bar should not be visible anymore). Let's say I have "ScreenB" as the destination for one bottom nav item. In "ScreenB" I see the content + the bottom bar. "ScreenB" contains a button which should open another screen "ScreenC". On "ScreenC" I should not see the bottom bar. Currently I am using the
    DestinationsNavigator
    to navigate to "ScreenC". Doing this inside the composable of "ScreenB". Something like
    navController.navigate(DeviceRegistrationScreenDestination)
    . The bottom bar is still shown on "ScreenC" which is obvious to me. Now the question is: Is it possible to launch a screen on top of the bottom bar without a callback to the first NavHost that contains the bottom bar?
    r
    i
    • 3
    • 3
  • s

    Suhaib Kazi

    04/23/2025, 10:19 AM
    destinations-kmp would've been nice to have 😅
  • s

    Suhaib Kazi

    04/23/2025, 1:25 PM
    Guys, idk if this makes sense But i want to try and see if i can make it work.
  • y

    yurihondo

    04/24/2025, 1:46 AM
    Hi @Rafael Costa , We find your Compose Destinations library very helpful for our Android project. Now that Compose 1.8 is stable, do you have an estimated timeline for a dedicated 1.8 version? Or will the current v2.1.0 (for 1.7) be compatible? This information would assist our planning. Thank you
    r
    • 2
    • 4
  • t

    Tomáš Procházka

    04/30/2025, 11:20 PM
    Please. What is the correct way how to handle deep links by
    DestinationsNavHost
    ? I get deep link intent from the Activity and pass it to my compose app. But
    DestinationsNavHost
    has just
    start
    parameter, there is no way how to put there deep link Uri. I found that this works:
    Copy code
    val navController = rememberNavController()
    val destinationNavigator = navController.rememberDestinationsNavigator()
    DestinationsNavHost(
     ...
    )
    navController.handleDeepLink(deepLinkIntent)
    But the issue is that it always display the
    start
    screen first and then replace it by the screen resolved from deeplink, which doesn't looks good. Maybe I can put some empty screen as
    defaultStartDestionation
    but this also looks like hack to me.
    r
    • 2
    • 4
  • r

    Ryan

    05/05/2025, 3:57 PM
    hey @Rafael Costa, I'm currently experiencing a crash
    Copy code
    Fatal Exception: java.lang.NullPointerException:
           at androidx.compose.material.navigation.BottomSheetNavigator$sheetContent$1$2$1.invoke(BottomSheetNavigator.java:182)
           at androidx.compose.material.navigation.BottomSheetNavigator$sheetContent$1$2$1.invoke(BottomSheetNavigator.java:181)
           at androidx.activity.compose.BackHandlerKt$BackHandler$backCallback$1$1.handleOnBackPressed(BackHandler.kt:89)
           at androidx.activity.OnBackPressedDispatcher.onBackPressed(OnBackPressedDispatcher.kt:260)
           at androidx.activity.ComponentActivity.onBackPressed(ComponentActivity.kt:588)
           at android.app.Activity.onKeyUp(Activity.java:4157)
           at android.view.KeyEvent.dispatch(KeyEvent.java:3522)
    where sheet content is null. My destinations that use the bottom sheet are styled as such:
    Copy code
    @Destination<RootGraph>(style = DestinationStyleBottomSheet::class)
    Would you prefer if I open a github ticket to discuss this? I don't have much information since I can't reproduce it locally, but it's a fairly frequent crash in production. composeDestination = "2.1.0-beta12" I'll upgrade to 2.2.0 in the meanwhile and monitor as well.
    r
    • 2
    • 5
  • i

    Ilia Kazantsev

    05/06/2025, 8:30 AM
    Hello everybody. I am trying to use ResultBackNavigatorMyType where MyType is
    Copy code
    import kotlinx.serialization.Serializable
    
    @Serializable
    data class ModificationError(
        val myBoolean: Boolean,
    )
    The issue is I am getting the error [ksp] com.ramcosta.composedestinations.codegen.commons.IllegalDestinationsSetup: Composable 'AddEditFavoritesScreen', ResultBackNavigatorModificationError: Result types must be of a valid navigation argument type, but was 'ModificationError' Library version is 2.1.0-beta16 Kotlin serialization 1.8.0 I am using multimodule architecture and the screen destination and ModificationError are in different modules. I would be so grateful to hear any suggestions what may be the problem here. 🥲 Am i missing something?
    r
    r
    • 3
    • 6
  • c

    Cash Hsiao

    05/19/2025, 6:40 AM
    Hello everyone, I'm trying applying compose-destination on my project (Previously I used kiwi but it stopped updating) I have a scenario: screenA -> screenB -> screenC -> get a result and back to screenA And I found
    ResultBackNavigator.navigateBack()
    use
    NavController.navigateUp()
    internally (In kiwi it doesn't contain navigateUp, so we can popBackStack manually) Is there any way to solve this problem?
    d
    r
    • 3
    • 3
  • s

    slack

    06/06/2025, 4:48 PM
    Hi @Rafael Costa, I was wondering if you still planning to support kmp
    r
    s
    • 3
    • 7
  • p

    Pranathi

    06/13/2025, 12:57 PM
    just for the extra information, why is ArrayList<> is usable for the nav args and not List<>?
    r
    s
    • 3
    • 3
  • m

    Magnus Gudmandsen

    06/23/2025, 7:42 AM
    Hello! I've had issues with
    ResultRecipient
    not sending any event to
    onNavResult
    (from a
    ResultBackNavigator
    in a bottom sheet destination, specifically). I can't identify exactly when this started to happen, but before digging too much (we already tried downgrading compose destinations, without luck), I just wanted to start out with checking if it's a known bug? Essentially, doing
    resultNavigator.navigateBack(foo)
    MOSTLY doesn't return a result. It's not a 100% fail rate, but almost.
    • 1
    • 1
  • b

    brandonmcansh

    07/03/2025, 9:37 PM
    I see mentions of BottomSheetDestinations not being able to get access to the AnimatedVisibilityScope when using SharedTransitionLayout. Is there any particular reason why that is the case?
    r
    • 2
    • 12
  • r

    Rohit Jakhar

    07/19/2025, 8:16 PM
    Hi, I have an jetpack compose project where i use hilt as di but now i am planning to migrating it to koin. before that this will code for my compose screen:
    Copy code
    @Destination<RootGraph>(style = SlideInScreenAnimation::class)
    @Composable
    fun ProfileScreen(
        vm: ProfileVM = hiltViewModel()
    )
    but after using koin it will be:
    Copy code
    @Destination<RootGraph>(style = SlideInScreenAnimation::class)
    @Composable
    fun ProfileScreen(
        vm: ProfileVM = koinViewModel()
    )
    so Profile viewmodel instance will be auto destroy if i navigate to other screen. It work with hiltViewModel but i am not sure about koinViewModel anyone can tell me? Thanks
    r
    • 2
    • 5