Tower Guidev2
01/17/2023, 3:04 PMandroidx.compose.material.SwipeToDismiss
within my android applications lists
on one particular list i would like to restrict my users to only being able to swipe manually Left to Right
however I would also like to programmatically swipe Right to Left on the same list
is this possible ?SwipeToDismiss(
state = dismissState,
modifier = Modifier.padding(horizontal = 4.dp),
dismissThresholds = { FractionalThreshold(0.3f) },
background = { SwipeToDismissOrSaveBackground(dismissState, this) },
directions = setOf(DismissDirection.EndToStart),
dismissContent = {
Box(Modifier.animateItemPlacement()) {
ContentItemCard(dismissState, item, onClick, onShare, onSwipeRight)
}
}
)
however when i programmatically swipe StartToEnd i get the following exception
FATAL EXCEPTION: main Process: com.elsevier.practiceupdate, PID: 26240
java.lang.IllegalArgumentException: The target value must have an associated anchor.
at androidx.compose.material.SwipeableState$animateTo$2.emit(Swipeable.kt:332)
at androidx.compose.material.SwipeableState$animateTo$2.emit(Swipeable.kt:329)
at kotlinx.coroutines.flow.FlowKt__LimitKt.emitAbort$FlowKt__LimitKt(Limit.kt:73)