moschan / react-native-flip-card

The card component which has a motion of flip for React Native(iOS/Android)
MIT License
390 stars 108 forks source link

Error Invariant Violation: Transform with key of "perspective" cannot be zero: {"perspective":0} #55

Closed syarofanz closed 5 years ago

syarofanz commented 6 years ago

If i flip the card will be error Invariant Violation: Transform with key of "perspective" cannot be zero: {"perspective":0}, that's bug ?

tekminewe commented 6 years ago

Still not able to found the root cause, but i managed to fix mine by adding perspective={1000} to the FlipCard component

denghejun commented 6 years ago

got the same issue and still not working after I add perspective={1000} to the FlipCard component

mag1492 commented 6 years ago

Only in Android ? Fix works 👍

mramadhanrh commented 6 years ago

Please add changes to the library, Thank you

markmckim commented 5 years ago

Was this ever updated in the lib? I can submit a PR with the change if necessary, but why the arbitrary value of 1000? Is this the correct/valid value?

markmckim commented 5 years ago

Looks this this is a known issue. See the following from React Native animation docs: https://facebook.github.io/react-native/docs/animations

While using transform styles such as rotateY, rotateX, and others ensure the transform style perspective is in place. At this time some animations may not render on Android without it. Example below.

<Animated.View
  style={{
    transform: [
      {scale: this.state.scale},
      {rotateY: this.state.rotateY},
      {perspective: 1000}, // without this line this Animation will not render on Android while working fine on iOS
    ],
  }}
/>

Looks like the right approach here might be to change the defaultProp in Flip Card to be 1000 instead of 0. I'll submit a PR