Is there a reason why `rememberDismissState` doesn...
# compose
h
Is there a reason why
rememberDismissState
doesn't receive
vararg inputs: Any?
kind of anchor to reset the state if some of the dependencies change? This certainly proved a challenge when I wanted to use
SwipeToDismiss
on list items. Because Lazy APIs reuse the same composable with different data, dismissState has to reset everytime the data changes.
Also on the subject of
SwipeToDismiss
, it only supports horizontal direction. I happened to achieve a very satisfactory result by just adding an orientation argument and selectively choosing offsetX or offsetY according to the orientation.
a
Please file it so that we have record of it. I'd like to make many of these custom
rememberFooState
functions go away in favor of more standard uses of
remember
itself, but each case we need to address has needed some thinking
Many things involving animation currently read the ambient animation frame clock, which we're moving over to be provided in CoroutineContexts launched from composition, so all of those get simpler. We'll probably take a similar approach for fling-related information which takes the density into account.
h
Filed issues for both
👍 1
s
If you run into future issues like that, you can also work around them using they
key
API before the library fixes get in. https://developer.android.com/reference/kotlin/androidx/compose/runtime/package-summary.html#key