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

zoha131

03/02/2021, 7:02 PM
Why do we have three different over load of
AnimatedVisibility
. More specifically why do we have
RowScope
and
ColumnScope
version of implementations? Isn’t without scope one is enough? I think I have seen this pattern for couple of other Composables. My curious minds wants to the reason behind it. 🧐
1
I realize this pattern because sometimes AS fails to import the right one. Also if I import the
ColumnScope
one then I can’t use any other version.
j

Jan Bína

03/02/2021, 10:30 PM
It's explained right in its javadoc:
When the [AnimatedVisibility] composable is put in a [Row] or a [Column], the default enter and exit transitions are tailored to that particular container.
z

zoha131

03/02/2021, 11:51 PM
@Jan Bína my qs is why three different version? why not single one without any scope.
z

Zach Klippenstein (he/him) [MOD]

03/02/2021, 11:53 PM
Because without the separately scoped overloads “the default enter and exit transitions are tailored to that particular container” would not be possible
💯 3