Tlaster / PreCompose

Compose Multiplatform Navigation && State Management
https://tlaster.github.io/PreCompose/
MIT License
858 stars 49 forks source link

Back animations sped up + stop working when interrupted in the middle #288

Open LukasAnda opened 8 months ago

LukasAnda commented 8 months ago

Describe the bug When I navigate to another screen and force the animations to be intentionally 3 seconds long, when I press back (on Android), it does not play the animation in the same speed, but only some sped-up version. This issue only happens when using native back button (on emulator for example) and not when calling navigateUp. Also, when I navigate back using system button during this long animation, the whole navigation breaks.

To Reproduce Steps to reproduce the behavior:

  1. Pull code from here: https://github.com/LukasAnda/Plank-Timer/tree/main
  2. Uncomment animation code in AppNavigation file
  3. Run the Android app.
  4. Navigate to settings and then (while the animation is running) navigate back.
  5. Try to navigate once again to no avail.

Expected behavior Navigation animations work correctly regardless of if I navigate up using code or system buttons.

Minimal reproducible example Mentioned in the first step

Tlaster commented 7 months ago

I am still trying to find the root cause of this. Another case is that if you try to navigate to another scene while the transition is running, the transition also seems to be incorrect.

VerushkinRoman commented 6 months ago

If i use androidx.activity.compose.BackHandler in actual android implementation, animation works as expected. But if I replace it with moe.tlaster.precompose.navigation.BackHandler, animation speed up