Skip to content

Instantly share code, notes, and snippets.

@carterhudson
Last active September 10, 2021 22:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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