swipe
swipe copied to clipboard
Permanent vibration on _slow_ swipe after threshold was crossed
Hi! After haptics feedback was added to this project, I noticed constant (and somehow annoying) vibration on slow swipes after threshold was crossed. Please consider changing it to one-shot vibration by replacing this code in SwipeableActionsBox composable
if (state.hasCrossedSwipeThreshold() && state.swipedAction == null) {
LaunchedEffect(state.visibleAction) {
hapticFeedback.performHapticFeedback(HapticFeedbackType.LongPress)
}
}
to
var offsetCrossed by remember { mutableStateOf(false) }
if (state.hasCrossedSwipeThreshold()) {
if (!offsetCrossed) {
offsetCrossed = true
LaunchedEffect(state.visibleAction) {
hapticFeedback.performHapticFeedback(HapticFeedbackType.LongPress)
}
}
} else {
offsetCrossed = false
}
or smth similar