https://kotlinlang.org logo
Join Slack
Powered by
# decompose
  • c

    CXwudi

    01/19/2025, 6:48 PM
    Hi, is it possible to use
    childPanels()
    navigation model and the
    ListDetailPaneScaffold()
    together instead of the
    ChildPanels()
    composable? It looks like the navigation models are so different that it doesn't seems to be possible. Maybe the only solution to use
    ListDetailPaneScaffold()
    with Decompose is to just call
    childContent()
    but not
    childPanels()
    ?
    a
    • 2
    • 2
  • r

    Rafael Costa

    02/03/2025, 12:20 PM
    Hi! Say that on a given component, I have a child slot. I want to expose a single
    uiState
    flow to my UI. As part of that UI State, if child slot is active, I want to provide the child instance, if it is not active I want to provide some other state data class. The way I see it, to do this, I would combine the
    Value<ChildSlot<X, Y>>
    with some other internal state flow. Question is: can I convert the
    Value
    into a StateFlow to allow me to combine it? Or is there any consequence of doing so, such as performance considerations or the like? I have a snippet that I think came from you @Arkadii Ivanov to do that conversion, I can paste on the thread.
    a
    • 2
    • 7
  • d

    Djuro

    02/05/2025, 9:22 AM
    Hello everyone. Using Decompose in a Compose multiplatform project. On iPhones they usually go back by swiping on the screen instead of using back arrows. Is there a possibility to enable going back on swipe for iPhones?
    a
    • 2
    • 2
  • a

    Arkadii Ivanov

    02/09/2025, 8:28 PM
    Decompose
    3.3.0-beta01
    is released! - Updated Essenty to
    2.5.0-beta01
    Release notes: https://github.com/arkivanov/Decompose/releases/tag/3.3.0-beta01
    decompose intensifies 2
    K 3
  • a

    Adi Trioka

    02/14/2025, 1:50 AM
    Hi everyone. I just tried using Decompose for navigation in my multiplatform project, and I’m a bit confused. I just watched Arkadii’s video here:

    https://youtu.be/FFO_4NNDUoU?si=6rKtIEiKv4egRJ59&amp;t=423▾

    . My question is, for nested navigation like this, do we need to create a screen for each parent component? For example, here we have the Signed Out and Signed In components. Do we need to create a composable SignedOutScreen and SignedInScreen as the parent composable for the child components/composables underneath?
    a
    • 2
    • 2
  • p

    Philip Dukhov

    02/20/2025, 5:31 AM
    Hey! I was wondering if
    StateKeeper
    `consume`/`register` methods could use the same technique (or have an overload) that
    Json.encodeToString
    does, so we don't have to pass the serializer manually, with something like
    essentyJson.serializersModule.serializer()
    ? I think I can use
    Json
    instead of
    essentyJson
    and do an extension on my end, as the lib doesn't and is not expected to modify the
    serializersModule
    in the future, but it would be nicer to be shipped with the lib.
    a
    • 2
    • 2
  • a

    Andrey Larionov

    02/25/2025, 1:46 PM
    Hi guys and @Arkadii Ivanov, I have a question Let's say each
    BottomNavigation
    tab (
    ExploreRootScreen
    ,
    WalletRootScreen
    and
    ProfileRootScreen
    ) has it's own
    ChildStack
    Copy code
    @Composable
    internal fun HomeRootScreen(component: HomeRootComponent) = Box(
        modifier = Modifier.fillMaxSize()
    ) {
        StackContent(component)
        BottomNavigation(component)
    }
    
    @Composable
    private fun StackContent(component: HomeRootComponent) {
        val homeStack by component.stackRouter.subscribeAsState()
        Children(
            // ...
            content = { childStack -> childStack.instance.getContentByChild() }
        )
    }
    
    @Composable
    private fun HomeRootChild.getContentByChild() = when (this) {
        // ...
        is ProfileRootChild -> ProfileRootScreen(this) // with ProfileRootComponent
    }
    BottomNavigation
    is drawn over
    StackContent
    using
    Alignment.Bottom
    If we need to display a Dialog (
    ChildSlot
    ) somewhere deep inside of tab's
    ChildStack
    , it should be drawn above
    BottomNavigation
    I created a diagram where
    LogoutDialog
    and
    SwitchLanguageDialog
    (marked with yellow color) should appear. Each child in the diagram (marked with blue, yellow and pink colors) has it's own
    ChildComponent
    (e.g,
    LanguageComponent
    and
    SwitchLanguageComponent
    ) And as I understand Decompose, for
    SwitchLanguageDialog
    I should create
    ChildSlot
    inside
    LanguageComponent
    and this Dialog should be displayed on
    LanguageScreen
    That's ok, but it will be drawn under the BottomNavigation I assume I could create
    ChildSlot
    at
    HomeRootComponent
    level, but • I'm not sure how to handle different children from different nested screens (e.g, using
    activeSlotChild: Flow<BaseSlotChild>
    seems odd due to a large
    when
    check) • I don't know if this approach would break children back navigation (e.g, when Dialog is displayed, using system back swipe might trigger
    ChildStack
    's backHandler) How should I handle this properly? Thanks in advance
    a
    • 2
    • 2
  • a

    Andrey Larionov

    02/25/2025, 1:46 PM
    CleanShot 2025-02-25 at 17.46.27.jpg
  • a

    Arkadii Ivanov

    02/25/2025, 4:30 PM
    Decompose
    3.3.0
    is released! Release notes: https://github.com/arkivanov/Decompose/releases/tag/3.3.0
    ♥️ 2
    🎉 7
  • p

    Philip Dukhov

    03/12/2025, 6:11 AM
    I'd like to set up navigation state logging for Sentry. One of the problems is that I can't think of a way to log the navigation tree - I have a deep tree of nested components. It may be enough to just log the stack being updated, perfectly it would be nice to name the action, like push/pop/pushNew, it could have been done with comparing old/new count, but may not be accurate with replacing multiple items. Another issue is that I often store a model object in the config, and in the log I would only want to include limited info about the object, like object id. Feels like I would need to parse strings manually, as Kotlin serialization is not flexible enough to allow me to override the serialization logic for each object of a specific interface. Any chance someone has already worked on something like this?
    a
    a
    • 3
    • 3
  • p

    Philip Dukhov

    03/12/2025, 2:08 PM
    Just wanted to say thanks for the library — my application architecture is much cleaner now, which has taken away a lot of stress and negative emotions, and I’m genuinely enjoying programming again 😊
    decompose intensifies 12
  • p

    Philip Dukhov

    03/24/2025, 5:57 AM
    In the release build with R8 I've got a crash from
    typeOf
    related to generic type
    Copy code
    data class InstanceToRetain<T>(val value: T)
    
    retainedSimpleInstance { InstanceToRetain(0) }
    Looks like it's something you've faced already, what do you think is the best workaround here? For now I switched to
    T::class
    , it obviously loses nested
    T
    info, but at least it would crash in debug app version if I try to use the same key somewhere, so it's easier to catch during development.
    a
    • 2
    • 1
  • s

    sasikanth

    03/26/2025, 4:24 AM
    Anyone used ChildPages with AndroidX Paging before? Is that at all possible? there is only List param when creating the initial pages, so just want to check to see if I am missing something. 🤔
    a
    v
    • 3
    • 4
  • v

    Vaibhav Jaiswal

    04/05/2025, 1:37 PM
    @Arkadii Ivanov I want to track ScreenName for Analytics purpose, I have a 3 layer nested Navigation hierarchy So Root Level Screens, it has a HomeScreen which has bottom navigation, and then each bottom nav tab has a Pager in it. How would you suggest achieving ScreenName tracking in such a multi layer nav structure ? One way I could think of is listening to the activeItem changes in childPages and childStack, but will that handle proper name change when a back navigation happens in a layer above.
    a
    • 2
    • 8
  • c

    Can

    04/09/2025, 9:15 AM
    Hey. We’ve come across an unexpected behavior in an edge case. We’re using a bottom bar, and clicking on the tabs triggers the
    bringToFront
    function in RootComponent. If the user—_for some mysterious reason_—starts rapidly switching between tabs, the navigation can get stuck on one of the screens. When that happens, the screen becomes unresponsive to clicks. We share the RootComponent in android and iOS and it affects both. I also noticed the same issue in the sample Decompose app.
    1.mp4
    a
    • 2
    • 5
  • a

    Andrey Larionov

    04/09/2025, 6:07 PM
    Hi I've faced the problem with predictive back navigation It worked great on Android and on iOS emulator, but it didn't work on real iPhone device And I found out that was because Compose
    1.8.0-beta01
    When I changed it with
    1.7.3
    ---> 👍
    👍 2
    d
    • 2
    • 1
  • a

    Andrew Steinmetz

    04/20/2025, 8:27 PM
    I know decompose comes with dependency injection out of the box, but as my projects were growing I switched over to kotlin-inject and kotlin-inject-anvil and was getting tired of writing a bunch of boiler plate code for the binding assisted factory interfaces similar to dagger. Since decompose heavily relies on assisted injection of the
    ComponentContext
    , I wrote a library that extends kotlin-inject-anvil to help bind and generate the assisted factory interface glue code to bind it in the kotlin-inject dependency graph that I thought others who use the library might be interested in. https://plusmobileapps.com/blog/2025/04/04/kotlin-inject-anvil-extensions/
    🙌 1
    👍 1
    a
    c
    • 3
    • 4
  • v

    Vaibhav Jaiswal

    05/01/2025, 11:20 AM
    @Arkadii Ivanov I have this usecase I need to call a suspend function in my RootComponent, but i want this to be called before the ChildStack Components are created This function call clears my Room DB, what i have done now is call it inside the
    doOnCreate
    but i am facing a bug that it sometimes completes after the ChildComponent is created, which then crashes as the app as db goes empty I want it to complete first (success or failure), then the ChildStack child components to be created
    a
    • 2
    • 1
  • v

    Vaibhav Jaiswal

    05/01/2025, 2:32 PM
    @Arkadii Ivanov is there a way to perform something when the predictive back nav is cancelled ? I have achieved it like this, it works, but is it correct ? Code in thread
    a
    • 2
    • 2
  • g

    Guyaume Tremblay

    05/01/2025, 8:30 PM
    @Arkadii Ivanov Following on my post in #CJLTWPH7S, I used Decompose already but I wondering if it could work with Compose Adaptive Layout ? I saw the new Child Panels but is it possible to use eg
    ListDetailPaneScaffold
    with ?
    a
    a
    • 3
    • 7
  • a

    Arkadii Ivanov

    05/03/2025, 12:33 AM
    Decompose
    3.4.0-alpha01
    is released! 👉 Use SPDX identifier in POMs 👉 Relax
    StrictMode
    with restarting the Activity stack for deep links 👉 Don't restart Activity stack when there is no deep link 👉 Added
    backHandlerPriority
    argument to
    childContext
    extension function 👉 Updated Compose to
    1.8.0-rc01
    and
    compileSdkVersion
    to 35 Release notes: https://github.com/arkivanov/Decompose/releases/tag/3.4.0-alpha01
    K 6
    decompose intensifies 2
  • a

    Alexandru Caraus

    05/13/2025, 1:17 PM
    @Arkadii Ivanov Is there a standard way to bridge ios app lifecycle e.g. app foreground/ app background to decompose lifecycle
    👀 1
    a
    • 2
    • 3
  • c

    CXwudi

    05/19/2025, 11:37 PM
    Hi, I made a copy of the ChildPanelsFactory.kt and added a new parameter to
    childPanels()
    called
    backHandler
    . As the name suggested, it allows the user to provide a customized back handler, and one of the handlers I provided is that in a
    MultiModeChildPanelsBackHandler
    where in triple mode, pressing back goes to dual mode, and dual to single. https://gist.github.com/CXwudi/03c5c7fae17518912b305f4e4b0423ea Let me know what do you thought
    a
    • 2
    • 3
  • c

    CXwudi

    05/19/2025, 11:48 PM
    Hi, I also made a custom implementation of ChildPanelsLayout called
    AdaptiveDetailsHorizontalChildPanelsLayout
    at https://gist.github.com/CXwudi/218dacd0b39c5f24ee5a6e6b2ebc6f9e where the detail page is adaptive but the other two have configurable fixed size. Let me know what do you think?
    👍 1
  • r

    Rok Oblak

    05/24/2025, 5:20 AM
    Hey, just reporting, on iOS + navigate back via swipe: Decompose
    3.3.0
    + CMP
    1.7.3
    worked fine upgrading to CMP
    1.8.0
    started crashing whenever back swipe was performed (something in a coroutine crashed, but crashlog is hard to decipher; normal back button i.e. pop from stack worked fine) then keeping CMP
    1.8.0
    but upgrading Decompose to
    3.4.0-alpha01
    fixed it again
    a
    • 2
    • 6
  • a

    Arkadii Ivanov

    05/31/2025, 12:22 PM
    Decompose 3.4.0-alpha02 is released! 👉 Added Child Items navigation model 👉 Added
    PagesNavigator#setItems
    extension function 👉 Deprecated
    Value#getValue
    operator overload 👉 Exposed
    ChildPagesPager
    typealias 👉 Avoid using
    Modifier.graphicLayer
    in predictive back animatables 👉 Fixed
    IndexOutOfBoundsException
    in
    ChildPages
    Release notes: https://github.com/arkivanov/Decompose/releases/tag/3.4.0-alpha02
    decompose intensifies 5
    K 4
  • j

    John O'Reilly

    06/08/2025, 5:38 PM
    Has anyone by chance tried updating a project using Decompose to CMP 1.9.0-alpha02. I'm getting following for some reason running Compose for Desktop app......could be nothing to do with Decompose but other projects I have don't seem to have this issue.
    a
    • 2
    • 12
  • a

    Arkadii Ivanov

    06/14/2025, 11:58 AM
    Hey folks! I have created a discussion about possible migration to AndroidX AAC API here. Please cast your vote as reactions, and feel free to comment!
  • v

    Vaibhav Jaiswal

    06/27/2025, 7:59 AM
    @Arkadii Ivanov If i start a flow in my RootComponent's coroutine scope and minimize the app, will the flow still run ?
    a
    • 2
    • 11
  • a

    Arkadii Ivanov

    06/28/2025, 1:15 PM
    Decompose 3.4.0-alpha03 is released! 👉 Added
    JetpackComponentContext
    API 👉 Updated Compose to
    1.8.2
    👉 Fixed
    ClassCastException
    in
    SlotNavigator#dismiss
    on
    wasmJs
    on Kotlin 2.2 Release notes: https://github.com/arkivanov/Decompose/releases/tag/3.4.0-alpha03
    👏 4