Let's say a composable is about to enter/added to ...
# compose
s
Let's say a composable is about to enter/added to the tree how can I animate it's enter transition ? Is there something similar to .transition modifier like swiftUI ?
d
AnimatedVisibility: https://developer.android.com/jetpack/compose/animation The video on top of the page would help if you are not familiar with the content on that page. πŸ™‚
s
@Doris Liu Is there any example of z index animation + Slide in/Slide out when transition from one screen to another like IOS have?
d
@Shakil Karim screen level enter/exit animations are ongoing work. πŸ˜„ Though I'm very curious about the z index animation that you are referring to. Could you share a demo of that?
s
@Doris Liu Sorry, I meant parallax effect like in this video
d
I see. The exiting screen slides out slower than the entering one. That should be doable if we support independent enter/exit transition for each screen. πŸ™‚ Thanks for sharing! πŸ™
πŸ‘ 1
s
Thanks for these referencesπŸ˜„
πŸ‘ 1
Okay, I tried animated visibility, it is not working. All I want it just animate enter transition on a composable?
d
Can you share a code snippet?
You'll probably need to do something like
AnimatedVisibility(visible = true, initiallyVisible = false)
to just show an enter transition. πŸ™‚
s
hmm, I am doing exactly this but this results in not showing anything to the screen
d
Does the composable show up without being wrapped in
AnimatedVisibility
?
s
yes, but when I wrap it, then nothing shows up
here is the code screenshot for that composable that I want to animate transition
d
That looks correct. Is this
AnimatedVisiblity
happen to be nested in another
AnimatedVisibility
? Are you using emulator or studio preview?
s
I am using physical android device, and no it is not nested in another
AnimatedVisibility
Its top level composable
HomeScree
just initializes a
viewModel
and pass the desired data down to this composable ?
d
What version of compose are you using, beta01, beta02?
s
just updated to beta02
d
If you could isolate the issue in a minimal repro case, I'm happy to take a look. πŸ™‚
πŸ’― 1
s
I probably will not be able to do that currently, but will try later on. thank you very much for answering by the way.
πŸ‘ 1
would you recommend something like this for time being, as replacement for
AnimatedVisibility
for enter transition ?
d
If that works for you, it's a valid option. πŸ™‚
s
Thanks, yes it works just thought If it would be valid to do like this.