Skip to content

Commit

Permalink
Remove haptic feedback when an action is swiped
Browse files Browse the repository at this point in the history
  • Loading branch information
saket committed Feb 3, 2024
1 parent 723200f commit a071a6c
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ fun SwipeableActionsBox(
}

val scope = rememberCoroutineScope()
val hapticFeedback = LocalHapticFeedback.current
Box(
modifier = Modifier
.onSizeChanged { state.layoutWidth = it.width }
Expand All @@ -85,7 +84,6 @@ fun SwipeableActionsBox(
enabled = !state.isResettingOnRelease,
onDragStopped = {
scope.launch {
hapticFeedback.performHapticFeedback(HapticFeedbackType.LongPress)
state.handleOnDragStopped()
}
},
Expand All @@ -104,9 +102,10 @@ fun SwipeableActionsBox(
)
}

if (state.hasCrossedSwipeThreshold()) {
val hapticFeedback = LocalHapticFeedback.current
if (state.hasCrossedSwipeThreshold() && state.swipedAction == null) {
LaunchedEffect(state.visibleAction) {
hapticFeedback.performHapticFeedback(HapticFeedbackType.TextHandleMove)
hapticFeedback.performHapticFeedback(HapticFeedbackType.LongPress)
}
}
}
Expand Down

0 comments on commit a071a6c

Please sign in to comment.