oblador / react-native-animatable

Standard set of easy to use animations and declarative transitions for React Native
MIT License
9.81k stars 702 forks source link

TypeError: undefined is not an object (evaluating 'Object.keys(definition)') #316

Closed thomas-negrault closed 4 years ago

thomas-negrault commented 4 years ago

My project, including this library, was working fine before. I don't know what changed but I have a weird error now: image

I tracked down the issue to node_modules/react-native-animatable/index.js When this execute: initializeRegistryWithDefinitions(ANIMATION_DEFINITIONS);

With a console.log, I see that ANIMATION_DEFINITIONS value is

{"AttentionSeekers": undefined, "BouncingEntrances": undefined, "BouncingExits": undefined, "FadingEntrances": undefined, "FadingExits": undefined, "Flippers": undefined, "Index": undefined, "Lightspeed": undefined, "SlidingEntrances": undefined, "SlidingExits": undefined, "ZoomingEntrances": undefined, "ZoomingExits": undefined}

In registry.js there is:

Object.keys(definitions).forEach(animationName => {
    registerAnimation(
      animationName,
      createAnimation(definitions[animationName]),
    );
  });

so createAnimation(definitions[animationName]) is called with undefined. Then in createAnimation.js there is const positions = Object.keys(definition) and that is the line causing the issue, because of Object.keys(undefined)

I already tried to delete/reinstall node_modules, I tried with node 11,12 and 13 but I still have the issue. Versions: Node: v14.3.0 Npm: 6.10.3 react-native-animatable: "^1.3.3", react-native: "0.62.2",

thomas-negrault commented 4 years ago

It seems the error was not related to this library. The issue was with babel-plugin-wildcard. I clean all references to this plugin in package.json and babel.config.js and it's working again !

Talha-Jawed commented 3 years ago

simulator_screenshot_0BAFCF7E-A598-4FC0-B695-0BF4BBD4415B

i have same issue in android and ios both in first time trigger the function . any luck how to resolve this isssue?