zak.taccardi
07/07/2020, 4:13 PM@Compose
support side effects, like launching a dialog or a Snackbar
that auto-dismisses itself after a short time?zak.taccardi
07/07/2020, 4:14 PMSean McQuillan [G]
07/07/2020, 4:18 PMonCommit(snackBarShown) {
// animate it
onDispose {
// the keys changed, or the containing composable has been removed
}
}
launchInComposition – launch a coroutine (this is the preferred way to express fixed intervals like 1_000ms, do other coroutines type things)
launchInComposition(snackbarShown) {
// launch a new coroutine when snackbarShown changes
}
Sean McQuillan [G]
07/07/2020, 4:20 PMzak.taccardi
07/07/2020, 4:34 PMMaking side effects inside of composition (in the main body of a composable function or lambda) is not a supported use case.Oh for sure. I would just be consuming from a regular
Channel()
to async display a UI component. But do these side effect UIs persist/restore themselves across config changes?Sean McQuillan [G]
07/07/2020, 5:02 PMzak.taccardi
07/07/2020, 10:24 PMDialogFragment
then do a config change, the DialogFragment
is still visible because the FragmentManager
handles restoring its stateSean McQuillan [G]
07/08/2020, 4:25 PMSean McQuillan [G]
07/08/2020, 4:26 PMSean McQuillan [G]
07/08/2020, 4:26 PMSean McQuillan [G]
07/08/2020, 4:29 PMsavedInstanceState
or rememberSavedInstanceState
or be hoisted out of compose to e.g. RoomSean McQuillan [G]
07/08/2020, 4:33 PMbrandonmcansh
08/04/2020, 1:03 PMbrandonmcansh
08/04/2020, 1:03 PM