arkivanov / Decompose

Kotlin Multiplatform lifecycle-aware business logic components (aka BLoCs) with routing (navigation) and pluggable UI (Jetpack Compose, SwiftUI, JS React, etc.)

Home Page:https://arkivanov.github.io/Decompose

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Document compose BackHandler <> decompose backHandler <> predictive back interaction

Nek-12 opened this issue · comments

Currently, if a screen overrides BackHandler using the respective composable function, predictive back animation is disabled. Proposed solution is to document how users can avoid missing out on predictive back animations when writing their feature-screen level logic and using decompose.

The best solution for such cases seems to be to only override back handler when the behavior of back button is going to be custom, i.e.

    BackHandler(enabled = state is DisplayingSignInForm) { component.navigateBack() }

the solution above will only disable predictive back when the state is not the initial one.

Closed via 8b7c87f.