https://kotlinlang.org logo
#compose
Title
# compose
h

Halil Ozercan

09/12/2020, 3:04 PM
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

Adam Powell

09/12/2020, 3:15 PM
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

Halil Ozercan

09/12/2020, 8:34 PM
Filed issues for both
👍 1
s

Sean McQuillan [G]

09/14/2020, 6:24 PM
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
12 Views