From a3cfd89c9551f636bf33d463ac4188c5db9a4326 Mon Sep 17 00:00:00 2001 From: Diego Beraldin Date: Wed, 20 Sep 2023 13:54:22 +0200 Subject: [PATCH] fix(common-ui): haptic feedback while swiping --- .../raccoonforlemmy/core/commonui/components/SwipeableCard.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/components/SwipeableCard.kt b/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/components/SwipeableCard.kt index e615d1d22..63371b2b0 100644 --- a/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/components/SwipeableCard.kt +++ b/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/components/SwipeableCard.kt @@ -27,6 +27,7 @@ import androidx.compose.ui.unit.toSize import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.onEach +import kotlinx.coroutines.flow.stateIn @OptIn(ExperimentalMaterialApi::class) @Composable @@ -71,7 +72,7 @@ fun SwipeableCard( it < -width * threshold -> DismissDirection.EndToStart else -> null } - }.onEach { willDismissDirection -> + }.stateIn(this).onEach { willDismissDirection -> if (willDismissDirection != null) { onGestureBegin() }