I’ve been trying to implement LayoutAnimation
to animate the insertion and deletion of items from scrollView. I’ve added the below code for the same.
import { LayoutAnimation, NativeModules } from 'react-native';
// Animation setup for android
const { UIManager } = NativeModules;
UIManager.setLayoutAnimationEnabledExperimental && UIManager.setLayoutAnimationEnabledExperimental(true);
to set the layout animation
// Animate the add or removal of shortlisted Rail
useEffect(
() => LayoutAnimation.configureNext({ ...LayoutAnimation.Presets.easeInEaseOut, duration: 500 }),
[shortlistItems],
);
Can anyone help me with this? why is this not working in android?
I’ve been following this documentation : https://reactnative.dev/docs/layoutanimation
NB : This works great in iOS without any issue.
2
Answers
I used Reanimated to overcome this. Now the application works really great.
REF 1 : https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/layout_animations/
REF 2 : https://youtu.be/6UXfS6FI674
I found the code mentioned here works better on Android:
https://github.com/facebook/react-native/issues/13207
Apparently there is some issue with the delete animation