rocketraman
03/23/2023, 8:28 PMMDCDialog
in an MVI application. I have a view model which has an open
state for the dialog. The dialog may be:
a) closed by some button press by the user, in which case the dialog is closed when it sees the open
state of the VM change to false, or
b) closed on scrim or escape, in which case I need to send an event to the VM (using the onClosed
hook seems appropriate)
The problem I have is when the dialog is closed via (a), my view model receives two inputs: the button press and the event from the onClosed
hook, which causes issues. Is there a way to trigger a callback only for the scrim/escape case?Big Chungus
03/23/2023, 8:40 PMrocketraman
03/23/2023, 8:42 PMclosing
and closed
are documented as "Indicates when the dialog begins/finishes its closing animation." I'm checking the action
value received in the event right now, they don't document what that is.Big Chungus
03/23/2023, 8:43 PMrocketraman
03/23/2023, 8:45 PMBig Chungus
03/23/2023, 8:45 PMrocketraman
03/23/2023, 8:48 PMscrimClickAction
and escapeKeyAction
because the close event action is undefined
(null in Kotlin) if I close the popup through state, and `scrimClickAction`/`escapeKeyAction` (which defaults to close
) if done via the scrim/esc.Big Chungus
03/23/2023, 8:48 PMBig Chungus
03/23/2023, 8:49 PMrocketraman
03/23/2023, 8:51 PMBig Chungus
03/23/2023, 8:51 PMBig Chungus
03/23/2023, 8:53 PMBig Chungus
03/23/2023, 8:54 PMrocketraman
03/23/2023, 8:55 PMrocketraman
03/23/2023, 8:56 PMLooks neat, btw!Thanks!