oblador / react-native-animatable

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

Question: Is it possible to use custom animations with the generic .transition function? #202

Open mackness opened 6 years ago

mackness commented 6 years ago

I am a little bit confused by this part of the documentation:

https://github.com/oblador/react-native-animatable#transitionfromvalues-tovalues-duration-easing

This is how I'm attempting to use it:

Animatable.initializeRegistryWithDefinitions({
  partialFadeIn: {
    style: {
      zIndex: 100
    },
    from: {
      opacity: 0
    },
    to: {
      opacity: 0.75
    }
  }
});

...

this.view
   .transition('partialFadeIn')
   .then((endState: any) =>
      this.setState({ isMoveCardFadeComplete: true })
    );

Which yields this error:

image

pdkn commented 6 years ago

Avoid the style object in animation. (if you need zIndex put it on the view.style):


  partialFadeIn: {
    from: {
      opacity: 0
    },
    to: {
      opacity: 0.75
    }
  }
});