Eric Ampire [MOD]
07/13/2021, 8:17 PMCard
and Surface have the onClick
parameter how can I define an onLongClick
assuming that the code below does not work
Modifier.combinedClickable(
onLongClick = {
Timber.e("Long Click")
}
)
Modifier.genericClickableWithoutGesture
that support onLongClick
is marked as internalRavi
07/13/2021, 8:49 PMModifier.pointerInput(Unit) {
detectTapGestures(
onLongPress = {
onLongClick()
},
onPress = {
onClick()
}
)
}
can u try this?Eric Ampire [MOD]
07/13/2021, 8:50 PMTash
07/13/2021, 11:21 PMCard
?@Composable
fun Test() {
var pressType by remember { mutableStateOf("none") }
Card(
modifier = Modifier
.fillMaxSize(0.6f)
.pointerInput(Unit) {
detectTapGestures(
onLongPress = {
pressType = "onLongPress"
},
onPress = {
pressType = "onPress"
}
)
},
backgroundColor = Color.LightGray
) {
Box(modifier = Modifier.fillMaxSize(0.5f)) {
Text("Press type = $pressType")
}
}
}
Eric Ampire [MOD]
07/14/2021, 6:02 AMTash
07/14/2021, 7:39 AMPavlo Rybitskyi
08/18/2021, 1:27 PMEric Ampire [MOD]
08/18/2021, 7:51 PM