https://kotlinlang.org logo
#compose
Title
# compose
k

K Merle

02/15/2022, 5:55 PM
What is the best way to prevent navigation fast double-tap opening same screen twice?
a

Alex Vanyo

02/15/2022, 6:08 PM
Assuming you’re using
navigation-compose
, check if the current `NavBackStackEntry`’s
Lifecycle
is
RESUMED
After the first tap navigates,
NavBackStackEntry
will no longer be
RESUMED
, which allows you to filter the second tap’s navigation request. An example of that is here: https://github.com/android/compose-samples/blob/e840fb90607069eb431f68d5291f03f400[…]k/app/src/main/java/com/example/jetsnack/ui/JetsnackAppState.kt
k

K Merle

02/15/2022, 6:43 PM
Thanks Alex. Is this something that will be implemented in the future in the library?
2 Views