arkivanov / Decompose

Kotlin Multiplatform lifecycle-aware business logic components (aka BLoCs) with routing (navigation) and pluggable UI (Jetpack Compose, SwiftUI, JS React, etc.)
https://arkivanov.github.io/Decompose
Apache License 2.0
2.2k stars 84 forks source link

Predictive back gesture animation not working when custom BackCallback registered #799

Open rsktash opened 13 hours ago

rsktash commented 13 hours ago

I've a master detail UI Master component shows list of items Details component shows selected item for editing In the Details component before navigating back it checks if the editing data has any change If data has changed a dialog will be shown in order to get confirmation from user about data loss on navigating back

telegram-cloud-photo-size-2-5226465945415967630-y

If I comment this code animation works

arkivanov commented 13 hours ago

Do you mean that the callback is registered in the child component? If so, then this is by design. You should disable the callback (set callback.enabled = false) when the confirmation is not required.

arkivanov commented 13 hours ago

Usually the dialog should be shown from the callback.

rsktash commented 13 hours ago

Yes, It's registered in a child component I've tested with subscribe { backCallback.isEnabled = doWeNeedConfirmation } Unfortunately it didn't change the behavior

arkivanov commented 13 hours ago

If you set enabled = false, then the animation should work. It would be nice to have a reproducer of the issue.

rsktash commented 11 hours ago

I've tested with minimal reproducer and it's working The issue was originating from a full screen dialog used for EditComponent

rsktash commented 11 hours ago

I'm using navigation suite and panels I tried to prevent user clicks on navigation buttons while editing an item Is there a way to temporarily switch panel mode to single?

rsktash commented 10 hours ago

OK. I've created base component and extension function in order to control panel mode

telegram-cloud-photo-size-2-5226773263210900364-y