react-native-reanimated icon indicating copy to clipboard operation
react-native-reanimated copied to clipboard

Can't get Layout Animations to work on a simple View

Open ernestasg152 opened this issue 4 years ago • 8 comments

Description

Not sure if it's a bug in the library, or if I'm missing something in the setup, but I can't get Layout Animations to work in any way, none of the stages seem to be working (entering, exiting, layout). I have a simple view that I'm trying to animate when toggling a state variable, but it just appears without any animations at all.

Expected behavior

Expected the view to fade in and out when mounting/unmounting.

Actual behavior & steps to reproduce

No animations are working in either stage.

Snack or minimal code example

{showView && <Animated.View
       style={[styles.ball, animatedStyles]}
       entering={FadeIn.duration(2000).springify().mass(0.3)}
       exiting={FadeOut.duration(2000).springify().mass(0.3)}
/>}

Package versions

  • React Native: 0.66.0
  • React Native Reanimated: 2.3.1 / https://github.com/software-mansion/react-native-reanimated#main (tried with both)
  • NodeJS: 16.1.0
  • Xcode: 13.2.1

Affected platforms

  • [ ] Android
  • [x] iOS
  • [ ] Web

ernestasg152 avatar Jan 03 '22 10:01 ernestasg152

Issue validator

The issue is valid!

github-actions[bot] avatar Jan 03 '22 10:01 github-actions[bot]

You seems using the useAnimatedStyle with component,

{showView && <Animated.View style={styles.ball} entering={FadeIn.duration(2000).springify().mass(0.3)} exiting={FadeOut.duration(2000).springify().mass(0.3)} />}

Majed04 avatar Jan 04 '22 07:01 Majed04

@Majiedo oh sorry, I forgot to mention that I tried it both ways actually, with and without the animated styles, and I still got the same outcome.

ernestasg152 avatar Jan 04 '22 11:01 ernestasg152

same, I've just setup the LayoutAnimation example, but the entering and exiting animation doesn't work.

samuelscheit avatar Jan 04 '22 13:01 samuelscheit

+1 I have the same problem.

muraterd avatar Jan 08 '22 13:01 muraterd

Hey @ernestasgobionis!

I encourage you to check out how it's done in the Example app

If it won't help, it would really help us if you provided Snack code example with your not-working code

kkafar avatar Jan 28 '22 11:01 kkafar

Hi @kkafar,

I think I have checked the Example app before and everything was working fine there, and as far as I remember I basically copied one of the examples and it didn't work.

But now I tried to reproduce it, and it seems to work now (magic 😀). Unless I was doing something different when submitting this issue, but I think it was an even simpler case that I used to reproduce it now.

ernestasg152 avatar Jan 28 '22 12:01 ernestasg152

Sometimes it this way! :D Glad to hear its working for you. Closing.

kkafar avatar Jan 28 '22 16:01 kkafar