Does someone know how to disable all interactions ...
# compose
j
Does someone know how to disable all interactions with the ui while showing a loading animation in compose.
p
Is the loader full screen? Set the Modifier.clickable {} and don't do anything. Is what first come to my mind
j
i will show the loading in full screen above all content. So, there might a form or something else could be clickable or focusable below the loading animation. That's why i want to disable them
p
Unless a Composable changes the order in which the touch event is consumed, it should be delivered to the outer most first. So it should be your loader background the one receiving it, if it is the most outer in the z axis. But I haven't tried this solution tbh, just suggesting it
j
ok. let me try it now
You're absolutely right man. That's worked. now i'm not able to click on button under the loading view
🆒 1
p
Anyway, do some research to see if there is something specific for your use case out there.
a
I use this (@Philip Dukhov), because I believe it's more _correct_: https://stackoverflow.com/a/69146178
👍 1
a
You can just use
Modifier.pointerInput(Unit) {}
. Also remember to apply
Modifier.clearAndSetSemantics {}
conditionally on the content below, otherwise they will still be interactable (e.g. buttons can be clicked) when using a screen reader.
z
You’ll also probably want to use onPreviewKeyEvent to block hardware keys
1