Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permanent vibration on _slow_ swipe after threshold was crossed #28

Open
thargon5090 opened this issue Apr 18, 2024 · 0 comments
Open

Comments

@thargon5090
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant