xxfast
11/28/2022, 11:55 PMback-pressed
to back-handler
api to enable predictive back for jetbrains-compose
with the new StackNavigation
. Previously (as of 0.6.0) we had to do
val LocalBackPressedHandler: ProvidableCompositionLocal<BackPressedHandler?> = staticCompositionLocalOf { null }
// On activity
val backPressedHandler = BackPressedHandler(onBackPressedDispatcher)
setContent {
CompositionLocalProvider(LocalBackPressedHandler provides backPressedHandler) {
..
}
}
is this no longer necessary given the ChildStack
has a handleBackButton
?Arkadii Ivanov
11/29/2022, 12:06 AMdefaultComponentContext
extension function and is propagated via Locals.
Yes, you can just pass handleBackButton = true
argument and Child Stack will automatically pop screens on back presses.xxfast
11/29/2022, 5:17 AMArkadii Ivanov
11/29/2022, 8:30 AM