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

Warning: Overriding previous layout animation with new one before the first began #47

Open
wachunei opened this issue Jan 17, 2017 · 15 comments

Comments

@wachunei
Copy link

One of my components changes state in order to render an InputText, the state change handler has set LayoutAnimation.configureNext to animate this state transition. It seems like this is being fired at the same time KeyboardSpacer animates itself, throwing the next warning:

Warning: Overriding previous layout animation with new one before the first began

Both animations (spacer and my component's state change) render without issues.

Is there a way to avoid this?

@perrosnk
Copy link

I am getting the same error, after opening, then closing a selector/picker and then auto-focusing on textinput.

Warning: Overriding previous layout animation with new one before the first began:
{
    create =     {
        property = opacity;
        type = keyboard;
    };
    delete =     {
        property = opacity;
        type = keyboard;
    };
    duration = "349.9999940395355";
    update =     {
        type = keyboard;
    };
} -> {
    create =     {
        property = opacity;
        type = keyboard;
    };
    delete =     {
        property = opacity;
        type = keyboard;
    };
    duration = 250;
    update =     {
        type = keyboard;
    };
}.

could it be related to:facebook/react-native#10606 ?

@ravirajn22
Copy link

Guys any updates on this warning... seems still its not fixed

@edencakir
Copy link

+1

@MacKentoch
Copy link

Any enlightenment would be warmfully welcomed.

@brenordr
Copy link

May help, I was running in a similar issue in other project
facebook/react-native#12663

@MutatedBread
Copy link

Hi guys, I had this error as well, but only on iOS.

I only modify the duration of layout animation to something like 1 or 0. Then the error does not show up.

Default animation duration of 200 on android works fine for me.

@joshuat
Copy link

joshuat commented Sep 8, 2018

This pull request seems to have fixed it for me:

#66

@msqar
Copy link

msqar commented Jan 24, 2019

Any idea on how should I fix this? it will happen on production app too, right? it's annoying! to me, it happens when i got the keyboard opened and i show an alert. But this can totally happen with other stuff that i show after the keyboard is up... please help :(

@akhan118
Copy link

akhan118 commented Jul 1, 2020

Turning off Debug worked for me.

@toadums
Copy link

toadums commented Jul 6, 2020

I've noticed this when input focus changes quickly (in debug mode at least). For me setting blurOnSubmit={false} on my TextInputs made the issue go away. In my case that's the behaviour I wanted anyways

@rahulje9
Copy link

any update on this?
I'm still getting this issue.

@porquelaquiero
Copy link

still have this issue. please share your solutions.

@Bardiamist
Copy link

I'll try this temp solution, seems works

let isLayoutAnimationConfigured = false;

const configureKeyboardLayoutAnimation = ({
  duration,
  easing,
}: KeyboardEvent) => {
  if (!isLayoutAnimationConfigured) {
    isLayoutAnimationConfigured = true;

    LayoutAnimation.configureNext(LayoutAnimation.create(
      duration,
      (LayoutAnimation.Types[easing] as any),
      (LayoutAnimation.Properties.opacity as any),
    ), () => {
      isLayoutAnimationConfigured = false;
    }, () => {
      isLayoutAnimationConfigured = false;
    });
  }
};

@KrisLau
Copy link

KrisLau commented Aug 5, 2021

This pull request seems to have fixed it for me:

#66

This worked, thank you! I ran yarn remove react-native-keyboard-spacer to remove the original package from my project then pulled the PR with yarn add Andr3wHur5t/react-native-keyboard-spacer#66/head and the error disappeared.

EDIT: It seems to have introduced a new error

RCTBridge required dispatch_sync to load RCTDevLoadingView. This may lead to deadlocks

@fukemy
Copy link

fukemy commented May 16, 2023

I'll try this temp solution, seems works

let isLayoutAnimationConfigured = false;

const configureKeyboardLayoutAnimation = ({
  duration,
  easing,
}: KeyboardEvent) => {
  if (!isLayoutAnimationConfigured) {
    isLayoutAnimationConfigured = true;

    LayoutAnimation.configureNext(LayoutAnimation.create(
      duration,
      (LayoutAnimation.Types[easing] as any),
      (LayoutAnimation.Properties.opacity as any),
    ), () => {
      isLayoutAnimationConfigured = false;
    }, () => {
      isLayoutAnimationConfigured = false;
    });
  }
};

nice solution, thanks so much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests