Hello the code is very simple on pressing a button i am changing the mutableState value.But i found the on button press recomposition is happening multiple time.
So is this some bug or for button the property is a bit different
This is caused by the ripple effect that the button makes, you can do the following to stop this from happening:
class NoRippleInteractionSource() : MutableInteractionSource {
override val interactions: Flow<Interaction> = emptyFlow()
override suspend fun emit(interaction: Interaction) {}
override fun tryEmit(interaction: Interaction) = true
}
And in your Button add this:
Button(
interactionSource = NoRippleInteractionSource(),
onClick = { }) {
Text("PressMe")
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With