question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Animation Definitions Must Have At Least Two Values

See original GitHub issue

Screenshot 2019-05-19 at 09 05 47

Installing the library via yarn and importing it into my app like so causes it to crash, the code is:

import React from 'react'
import { SafeAreaView, Text } from 'react-native'
import styled from 'styled-components/native'
import metrics from 'styles/metrics'
import Modal from 'react-native-modal'

type CardOverlayProps = {
  visible: boolean,
}

const CardOverlay = ({ visible }: CardOverlayProps) => {
  return (
    <Modal isVisible={visible}>
      <Container>
        <Card>
          <Text>A</Text>
        </Card>
      </Container>
    </Modal>
  )
}

When I add the “import Modal” line the app crashes with an error along the lines:

Animation definitions must have at least two values. Once I remove it, everything works. The original Modal component works to.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
jesster2k10commented, May 19, 2019

Okay,

So I found how to fix this. The error in fact was with the react-native-animatable library in the registry.js file in this particular function

export function initializeRegistryWithDefinitions(definitions)

I found for some reason that {__esModule:true } was being included in that definitions array which led to the whole two values error as that was a boolean.

So to fix it I just added a check in the function there

 export function initializeRegistryWithDefinitions(definitions) {
  Object.keys(definitions).forEach(animationName => {
    console.log(definitions);
    if (animationName !== '__esModule') { // this got rid of the crash
      registerAnimation(
        animationName,
        createAnimation(definitions[animationName]),
      );
    }
  });
}

I’ll close this and open a PR in the original library

1reaction
jesster2k10commented, Jul 30, 2019

Yeah I’ve had a number of problems with that plugin and other libraries but without enabling it my hot reloading wouldn’t work so I went ahead and made a fork of the library including the change so I can keep using this and my hot reloading

On Tue 30 Jul 2019 at 16:54, Roman Kuzkokov notifications@github.com wrote:

Hi, @jesster2k10 https://github.com/jesster2k10 I faced the same problem. It seems, that the problem isn’t in any of the libraries, but rather in the @babel/plugin-transform-modules-commonjs. It’s adding __esModule: true to exported object, this why this error is happening. Probably, there are some settings for this module, but so far I just removed it from my babel.config.js, and Modal is working great.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/react-native-community/react-native-modal/issues/309?email_source=notifications&email_token=ABRHYDTEUUNCRL2MEHQRLOLQCBP2LA5CNFSM4HN35FJ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3EN65A#issuecomment-516480884, or mute the thread https://github.com/notifications/unsubscribe-auth/ABRHYDWCLZKLXCNYE7RSMGTQCBP2LANCNFSM4HN35FJQ .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Animation Definitions Must Have At Least Two Values #309
Animation definitions must have at least two values . Once I remove it, everything works. The original Modal component works to.
Read more >
Error: Animation definitions must have at least two values
I am continuously getting the following error: Animation definitions must have at least two values. I tried looking it up in the repo...
Read more >
What Does Animating on Ones, Twos & Threes Mean? - iD Tech
This means that there would be 24 individual drawings for every second's worth of animation. Frames, in general animation context, refer to ...
Read more >
animation - CSS: Cascading Style Sheets - MDN Web Docs
The animation property is specified as one or more single animations, separated by commas. Each individual animation is specified as: zero, one, ...
Read more >
What Are the 12 Principles of Animation? - Pluralsight
The 12 Principles of Animation are Timing and Spacing, Squash and Stretch, Anticipation, Ease In and Ease Out, Arcs, Exaggeration, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found