-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Android] Layout animations enabled by default on android #3643
Comments
Hey! 👋 The issue doesn't seem to contain a minimal reproduction. Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem? |
React Native Layout Animation are something completely different than LayoutAnimation by react-native-reanimated. |
Then why are React Native's layout animations enabled by default when you install this library? Line 259 in e52d733
This line is called when initializing reanimated. If you look closely, ReanimatedNativeHierarchyManager inherits NativeViewHierarchyManager from React Native, so calling this enables React-Native's layout animations which are experimental on Android. I am not using reanimated's LayoutAnimations but I have some libraries that use React Native's layout animations. Enabling react native's layout animations breaks those libraries so I have to re-disable it manually after reanimated initializes. My question is: Is it safe to do? Why are react-native's layout animations enabled by default? |
You're referring to https://reactnative.dev/docs/layoutanimation, which has nothing to do with https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/layout_animations |
I know these are completely different. This is what I'm saying. react-native-reanimated is enabling react-native's layout animation which I believe should not happen, hence, I created this issue. If you put a breakpoint inside react-native's code to enable react-native's implementation of layout animations, you can clearly see that it is being enabled by react-native-reanimated. It should not. |
Kinda weird, but try this import { enableLayoutAnimations } from 'react-native-reanimated';
enableLayoutAnimations(false); |
I experienced the same issue but with I had
after setting edit: This was crashing/freezing iOS users, this is the native stacktrace:
edit 2: this is easily reproducible, just use a |
On my side I prefer to disable the react-native layout animation and the warning is gone too. import { UIManager } from 'react-native';
UIManager.setLayoutAnimationEnabledExperimental &&
UIManager.setLayoutAnimationEnabledExperimental(false); |
I also have this issue. Using setLayoutAnimationEnabledExperimental does not seem to work for IOS so that still causes native react native layout animations and react-native-reanimated layout animations to stumble over each other when using KeyboardAvoidingView on that platform. Turning react-native-reanimated layout animations off gets rid of the issue but then obviously you miss the animations you want to keep. @hatem-72 have you managed to get react-native-reanimated + KeyboardAvoidingView + IOS working? |
I got this noisy warning from v3, it's show with IOS device |
Description
Layout Animations are enabled by default on Android. The react-native doc says they are experimental on this platform:
https://reactnative.dev/docs/layoutanimation
I use layout animations on my app on iOS only and having them enabled on android breaks multiple parts of the app. Is it safe to just disable them again by calling the following code?
Here's the line that enables them:
react-native-reanimated/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ReanimatedNativeHierarchyManager.java
Line 259 in e52d733
Steps to reproduce
Just install react-native-reanimated, launch an app ( you can use the example ).
Snack or a link to a repository
https://github.com/software-mansion/react-native-reanimated/tree/main/Example
Reanimated version
2.9.0
React Native version
0.67.4
Platforms
Android
JavaScript runtime
Hermes
Workflow
No response
Architecture
No response
Build type
No response
Device
No response
Device model
No response
Acknowledgements
Yes
The text was updated successfully, but these errors were encountered: