Last active
January 31, 2017 23:41
-
-
Save aliakakis/2f36b3d4f8710bc33ecf2abf907b4c01 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {Component, PropTypes} from 'react'; | |
import Animate from 'grommet/components/Animate'; | |
export const RouteTransition = (options = {"animation": "fade", "duration": 1000, "delay": 0}) => (TargetComponent) => { | |
class EnhanceComponent extends Component { | |
constructor(props) { | |
super(props); | |
} | |
render() { | |
return ( | |
<Animate visible={true} | |
enter={options} | |
keep={true}> | |
<TargetComponent {...this.props}/> | |
</Animate> | |
); | |
}; | |
} | |
EnhanceComponent.defaultProps = { | |
}; | |
EnhanceComponent.propTypes = { | |
}; | |
return EnhanceComponent; | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
RouteTransition decorator for Grommet. Just wrap your class with this function or use @RouteTransition() to have a fade effect for your routes.