Thread
#compose
    v

    Vinay Gaba

    1 year ago
    this is the handler in question
    @Composable
    internal fun BackButtonHandler(onBackPressed: () -> Unit) {
        Providers(
            AmbientBackPressedDispatcher provides LifecycleOwnerAmbient.current as AppCompatActivity
        ) {
            handler {
                onBackPressed()
            }
        }
    }
    i

    Ian Lake

    1 year ago
    Yeah, you don't want the
    LifecycleOwnerAmbient
    , you probably want to start with
    ContextAmbient
    Ideally, Compose just provides a
    OnBackPressedDispatcherOwnerAmbient
    that does exactly that for you
    v

    Vinay Gaba

    1 year ago
    Thanks a lot Ian! Let me give this a shot and see how far I get with it 😄
    @Ian Lake This is going to be a busy week for you given how highly anticipated navigation support was. I really appreciate you taking the time in answering all our questions 🙏🏼
    Is something like
    OnBackPressedDispatcherOwnerAmbient
    on the roadmap?
    i

    Ian Lake

    1 year ago
    I'd be all for it. Do you mind filing an issue against Jetpack -> Compose?
    v

    Vinay Gaba

    1 year ago
    Absolutely!
    i

    Ian Lake

    1 year ago
    If you could paste a link to it here when you file it, I'll make sure it is routed to the right person
    v

    Vinay Gaba

    1 year ago