LayoutAnimation singleton generates "Warning: Overriding previous layout animation" when multiple components animate at once.
See original GitHub issueDescription
LayoutAnimation can not deal with multiple components animating at once. The console has the message:
Warning: Overriding previous layout animation with new one before the first began
Reproduction
Component A does
LayoutAnimation.configureNext(A_configurableAnimation);
this.setState ({ someState});
Component B also does similarly:
LayoutAnimation.configureNext(B_configurableAnimation);
this.setState ({ someOtherState});
If A and B’s state change at the same time (or rather when React resolves their new states), the warning message appears and B’s animation is overridden by A’s configuration (or vice versa depending on timing).
Solution
LayoutAnimation would be more flexible as an instance instead of a singleton. For example:
myLayoutAnim = new LayoutAnimation(this.state);
This would allow each component’s LayoutAnimation to operate independently of any others.
Additional Information
- React Native version: 0.34
- Platform: iOS
- Operating System: OSX
Issue Analytics
- State:
- Created 7 years ago
- Reactions:18
- Comments:9 (3 by maintainers)
Top Results From Across the Web
How should LayoutAnimation be activated on component ...
It turns out calling LayoutAnimation.configureNext() in componentDidUpdate or useEffect does produce the animation when properties change.
Read more >LayoutAnimation - React Native
Automatically animates views to their new positions when the next layout happens. ... Schedules an animation to happen on the next layout.
Read more >React Native LayoutAnimation - Level Up Coding
Animated applies transformations to components on the screen without changing the actual layout of components on the screen. In other words, animating one...
Read more >Animation | Framer for Developers
There are multiple ways to animate in Framer Motion, scaling to the ... When any value in animate changes, the component will automatically...
Read more >LayoutAnimation | FlashList - Shopify
LayoutAnimation is a popular way how to animate views in React Native. ... configureNext` in order for the animation to run properly.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This would be a valuable enhancement. The ability to perform animations on more than one object at a time is common and necessary to rich UI. Vote to reopen this issue.
Any update on this issue? Please open this issue, I think it is an important issue, Or please suggest some workaround for this.