Fixed
Status Update
Comments
ap...@google.com <ap...@google.com> #2
It is expected that BackHandler
crashes in cases where no LocalOnBackPressedDispatcherOwner
Given that LocalOnBackPressedDispatcherOwner.current
is nullable, you can certainly wrap your call to BackHandler
in a null check if you'd like to specifically disable that functionality when in @Preview
. Of course, you could just provide your own OnBackPressedDispatcherOwner
by constructing an OnBackPressedDispatcher
instance yourself as part of your @Preview
.
Andrey - any thoughts on whether we should have @Preview
automatically create and set a LocalOnBackPressedDispatcherOwner
as we do for LocalViewModelStoreOwner
Description
Add fun Modifier.onFocusChanged(onFocusChanged: (FocusState) -> Unit): Modifier that fires when the focus changes. (Modifier.onFocusEvent is triggered every time requestFocus() is called, even if the focus state is unchanged)