Skip to content

Instantly share code, notes, and snippets.

@carterhudson
Last active September 10, 2021 22:53
Show Gist options
  • Save carterhudson/1369f319d68bfe504179a8ffecc1ee03 to your computer and use it in GitHub Desktop.
Save carterhudson/1369f319d68bfe504179a8ffecc1ee03 to your computer and use it in GitHub Desktop.
@Preview
@Composable
fun CustomRepeatingButton() {
Box(modifier = Modifier.fillMaxSize()) {
var repeatCount by remember { mutableStateOf(0) }
val interactionSource = remember { MutableInteractionSource() }
Surface(
modifier = Modifier
.repeatingClickable(
interactionSource = interactionSource,
enabled = true,
onClick = {
repeatCount++
}
)
.align(Alignment.Center)
) {
Row {
Text(
modifier = Modifier.padding(6.dp),
text = "Repeat Count: $repeatCount"
)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment