lhandel / react-native-card-flip

Card flip animation for React Native
MIT License
252 stars 61 forks source link

Slow animation in componentDidMount #5

Closed spyr0s closed 5 years ago

spyr0s commented 6 years ago

I want to use the card flip in my components did mount method to set the initial state of the cards. The problem is that the animation is too slow. I found out that it was because of this in CardFlip.js

this.state ={
      duration: 5000,
      side: 0,
      sides: [],
      progress: new Animated.Value(0),
      rotation: new Animated.ValueXY({x: 50, y: 50}),
      zoom: new Animated.Value(0),
      rotateOrientation: '',
      flipDirection: 'y'
    }

The default duration is set to 5000 and wasn't respecting the duration I was setting in the CardFlip property. I had to manually change it to 1000 but it would be better if this could be fixed in the official code.

This only happens if I use card.flip() in the componentDidMount of my component. In any other case it works as expected

jeongsd commented 5 years ago

Same here