Does someone know how to disable all interactions ...
# compose
Does someone know how to disable all interactions with the ui while showing a loading animation in compose.
Is the loader full screen? Set the Modifier.clickable {} and don't do anything. Is what first come to my mind
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
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
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
Anyway, do some research to see if there is something specific for your use case out there.
I use this (@Philip Dukhov), because I believe it's more _correct_:
👍 1
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.
You’ll also probably want to use onPreviewKeyEvent to block hardware keys