Using jetpack compose, for a clickevent how to perform haptic feedback. I am new to jetpack compose. This is what i tried -
val hapticFeedback = LocalHapticFeedback
@Composable
fun Tab() {
Row() {
Icon(imageVector = icon, contentDescription = text)
if (selected) {
// i tried both the following ways, none are working.
hapticFeedback.current.performHapticFeedback(
HapticFeedbackType(10)
)
hapticFeedback.current.performHapticFeedback(HapticFeedbackType.TextHandleMove)
....
Spacer(Modifier.width(12.dp))
Text(text.uppercase(Locale.getDefault()))
}
}
}
I am able to see the text when it is getting selected, but not getting a subtle vibrating feedback.
HapticFeedbackType.TextHandleMove
, doesn't seems to be working when performed a clickable action onlyHapticFeedbackType.LongPress
works. – Shreve