I have noticed that if I'm using multiple `Modifie...
# compose
s
I have noticed that if I'm using multiple
Modifier.pointerInput(key)
in my composable, I need to make sure that the same
key
is used for all of them. What could be the reason for this?
z
what happens if you use different keys?
s
sorry I should have also mentioned that. if different keys are used, upstream pointer inputs stop working. I had this code:
Copy code
Modifier
  .pointerInput(gesturesEnabled) { … }
  .pointerInput(Unit) { … }
and the first
pointerInput
wasn't working until I used
gesturesEnabled
as the key for the second modifier as well
s
Sounds like a bug to me tbh, I don’t see a reason why this behavior would be intended. What if you had a pointerInput on one composable, and then 4-5 composables down the line (so you couldn’t draw this conclusion, nor use the same key) you had another pointerInput which broke in this way? I’d file a bug with a repro.
z
Yea that seems like a bug for sure, they should be independent.
s
I'll file a bug. It'll be really funny if I'm unable to create a reproducer because the bug is somewhere else in my code.
s
Haha well, this has happened more times than I like to admit when I decide to file a bug
d
The .pointerInput docs says:
Copy code
The pointer input handling block will be cancelled and re-started when pointerInput is recomposed with a different key1.
Maybe that is immediately cancelling the first one.
s
This simply means that a currently ongoing pointer action will be cancelled and restarted on a key change, I don't think that this piece of text describes what Saket is experiencing here.