Skip to content
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

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

Closed
peacechen opened this issue Mar 2, 2017 · 9 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@peacechen
Copy link

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
@hramos
Copy link
Contributor

hramos commented May 25, 2017

We're cutting down on the number of outstanding issues, in order to allow us to focus. I'm closing this issue because it has been open for over 60 days with no activity. If you think it should still be opened let us know why. PRs are always welcome.

@hramos hramos closed this as completed May 25, 2017
@peacechen
Copy link
Author

peacechen commented 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.

@henrikra
Copy link

@peacechen Is it possible for you to do PR of your solution? :) We have same issue when using KeyboardAvoidingView because it uses LayoutAnimation. We get the warning when keyboard is closing and at the same time we show Alert.

@giladno
Copy link
Contributor

giladno commented Mar 16, 2018

@henrikra same here (using KeyboardAvoidingView and displaying an Alert).

Any fix on this one?

@peacechen
Copy link
Author

peacechen commented Mar 16, 2018

@henrikra Unfortunately I don't have a PR. This seems like it would be a major change deep in the RN code. I'm not familiar enough with the architecture of the animation engine and FB would not likely accept it (I've submitted PRs much smaller that haven't been accepted)

@ankur-sardar
Copy link

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

@Dexwell
Copy link

Dexwell commented Apr 16, 2018

This is still a problem, +1 on reopen @hramos

@VicFrolov
Copy link

+1 on reopen, still getting tons of warnings for this.

@hramos
Copy link
Contributor

hramos commented May 24, 2018

Please submit a new issue, this has been closed for almost a year.

@facebook facebook locked as resolved and limited conversation to collaborators May 24, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

8 participants