question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

LayoutAnimation singleton generates "Warning: Overriding previous layout animation" when multiple components animate at once.

See original GitHub issue

Description

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:closed
  • Created 7 years ago
  • Reactions:18
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

61reactions
peacechencommented, May 26, 2017

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.

6reactions
ankur-sardarcommented, Apr 2, 2018

Any update on this issue? Please open this issue, I think it is an important issue, Or please suggest some workaround for this.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found