Status Update
Comments
ra...@gmail.com <ra...@gmail.com> #2
Is this specific to navigation? Or can this be reproduced with another other Composable component?
sg...@google.com <sg...@google.com>
ma...@google.com <ma...@google.com> #3
It only happens inside of a NavHost. So, yes, it seems to be specific to navigation.
ra...@gmail.com <ra...@gmail.com> #4
This was caused by the fix to BackHandler
lifecycle aware. The problem here is that the NavController
registers its lifecycle and added an observer to the Activity
Lifecycle
in composition while the BackHandler
registers its observer on the Activity
Lifecycle
in a DisposbleEffect
. This means that the NavController
will always get Lifecycle callbacks before the BackHandler
, so the components listening the the NavController
's lifecycle (like the NavBackStackEntry) will always get their Lifecycle callbacks before the BackHandler
as well.
This should be addressed by work coming in 2.7 to integrate the BackHandler
into the NavHost
.
ra...@gmail.com <ra...@gmail.com> #5
Branch: androidx-main
commit d2c5efe67531a30fb9f1a129d52beb1e9ece0b29
Author: Jeremy Woods <jbwoods@google.com>
Date: Wed May 31 23:09:54 2023
Integrate BackHandler into NavHost
Instead of NavHost taking over the onBackPressedDispatcher from the
Activity, we should just make it use a BackHandler. This will ensure
that it interacters with the other BackHandlers in Compose correctly.
RelNote: "`NavHost` now correctly intercepts system back calls even
after the Activity has been `STOPPED` and `RESUMED`."
Test: modified tests
Bug: 279118447
Change-Id: Icb6deab996d122487243f0d3d775af8c15fc7c25
M navigation/navigation-compose/src/androidTest/java/androidx/navigation/compose/NavHostTest.kt
M navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavHost.kt
ma...@google.com <ma...@google.com> #6
This has been fixed internally and will be available in Navigation 2.7.0-beta01.
ra...@gmail.com <ra...@gmail.com> #7
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.navigation:navigation-compose:2.7.0-beta01
Description
Jetpack Compose version: 1.2.0-alpha07 Jetpack Compose component used: material3
Use Slider with zero width constrants, then change the density, the Slider might causes app crash:
Here is a simple code to reproduce that:
Just drag the slider, it will crash very soon