react-native-keyboard-spacer icon indicating copy to clipboard operation
react-native-keyboard-spacer copied to clipboard

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

Open wachunei opened this issue 7 years ago • 15 comments

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?

wachunei avatar Jan 17 '17 18:01 wachunei

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:https://github.com/facebook/react-native/issues/10606 ?

perrosnk avatar Jan 30 '17 01:01 perrosnk

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

ravirajn22 avatar Jun 13 '17 05:06 ravirajn22

+1

edencakir avatar Jun 22 '17 10:06 edencakir

Any enlightenment would be warmfully welcomed.

MacKentoch avatar Jun 29 '17 06:06 MacKentoch

May help, I was running in a similar issue in other project https://github.com/facebook/react-native/issues/12663

brenordr avatar Jul 17 '17 12:07 brenordr

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.

MutatedBread avatar Jun 18 '18 07:06 MutatedBread

This pull request seems to have fixed it for me:

Andr3wHur5t/react-native-keyboard-spacer#66

joshuat avatar Sep 08 '18 21:09 joshuat

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 :(

msqar avatar Jan 24 '19 21:01 msqar

Turning off Debug worked for me.

akhan118 avatar Jul 01 '20 01:07 akhan118

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

toadums avatar Jul 06 '20 19:07 toadums

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

rahulje9 avatar Nov 28 '20 15:11 rahulje9

still have this issue. please share your solutions.

porquelaquiero avatar Dec 26 '20 03:12 porquelaquiero

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;
    });
  }
};

Bardiamist avatar May 13 '21 07:05 Bardiamist

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

KrisLau avatar Aug 05 '21 13:08 KrisLau

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

fukemy avatar May 16 '23 07:05 fukemy