fix: re-check mutation-block inside gesture coroutines
Stale drag-tick coroutines launched before the flip no-op at execution time instead of moving the row after the reset.
This commit is contained in:
@@ -158,6 +158,7 @@ fun DictionaryListItem(
|
||||
val target = if (rawOffset <= -swipeThresholdPx) -maxSwipePx else 0f
|
||||
rawOffset = target
|
||||
scope.launch {
|
||||
if (isDeleteBlockedCurrent()) return@launch
|
||||
offsetAnim.animateTo(
|
||||
target,
|
||||
animationSpec = spring(stiffness = Spring.StiffnessMedium)
|
||||
@@ -169,6 +170,7 @@ fun DictionaryListItem(
|
||||
val target = if (rawOffset <= -swipeThresholdPx) -maxSwipePx else 0f
|
||||
rawOffset = target
|
||||
scope.launch {
|
||||
if (isDeleteBlockedCurrent()) return@launch
|
||||
offsetAnim.animateTo(
|
||||
target,
|
||||
animationSpec = spring(stiffness = Spring.StiffnessMedium)
|
||||
@@ -179,7 +181,10 @@ fun DictionaryListItem(
|
||||
if (isDeleteBlockedCurrent()) return@detectHorizontalDragGestures
|
||||
val newOffset = (rawOffset + dragAmount).coerceIn(-maxSwipePx, 0f)
|
||||
rawOffset = newOffset
|
||||
scope.launch { offsetAnim.snapTo(newOffset) }
|
||||
scope.launch {
|
||||
if (isDeleteBlockedCurrent()) return@launch
|
||||
offsetAnim.snapTo(newOffset)
|
||||
}
|
||||
}
|
||||
)
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user