react-native-animatable
react-native-animatable copied to clipboard
__esModule is being included in the initial animation definitons
For some reason, { "__esModule": true }
is being included in the array of animation definitions pre-installed in the library.
This causes the app to crash without fail, throwing this error:
Animation definitions must have at least two values.
since a boolean would have "only one value"
I found to fix it you could add a simple if clause to make sure the definitionName
does not equal __esModule
in the initializeRegistryWithDefinitions
function in registry.js
So it would look something like this:
export function initializeRegistryWithDefinitions(definitions) {
Object.keys(definitions).forEach(animationName => {
if (animationName !== '__esModule') {
registerAnimation(
animationName,
createAnimation(definitions[animationName]),
);
}
});
}
This works, but it seems a little hacky. I think the way the definitions are being imported/exported as esModules definitely has something to do with it.
For some reason,
{ "__esModule": true }
is being included in the array of animation definitions pre-installed in the library.This causes the app to crash without fail, throwing this error:
Animation definitions must have at least two values.
since a boolean would have "only one value"I found to fix it you could add a simple if clause to make sure the
definitionName
does not equal__esModule
in theinitializeRegistryWithDefinitions
function inregistry.js
So it would look something like this:
export function initializeRegistryWithDefinitions(definitions) { Object.keys(definitions).forEach(animationName => { if (animationName !== '__esModule') { registerAnimation( animationName, createAnimation(definitions[animationName]), ); } }); }
This works, but it seems a little hacky. I think the way the definitions are being imported/exported as esModules definitely has something to do with it.
I got same error in 2022 but still work this hacks.
react 17.0.2 react-native 0.67.2 react-native-modal 13.0.0 <-- cause error.