google / accompanist

A collection of extension libraries for Jetpack Compose
https://google.github.io/accompanist
Apache License 2.0
7.43k stars 598 forks source link

[Navigation-Animation] Fix NavController receiving back events even while AnimatedNavHost is not in composition #1632

Closed Leedwon closed 1 year ago

Leedwon commented 1 year ago

Hi folks, I think there's a bug in the library which casues navController to receive back events even if AnimatedNavHost is not in composition. Because of that each time AnimatedNavHost gets recomposed new navController will be registered for receiving back events which can lead to weird issues with back navigation. Please check the MRE and detailed description in this repo.

Fix is based on androidx.navigation.compose.NavHost which has the same mechanism for disabling back events in onDispose.

google-cla[bot] commented 1 year ago

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

ianhanniballake commented 1 year ago

As per this comment, all of Accompanist Navigation Animation has already been merged back into Navigation Compose itself, so we won't be updating Accompanist anymore - you'll just be able to use Navigation 2.7.0-alpha01 once it comes out, which, as you've mentioned, already contains this fix.