Skip to content

Instantly share code, notes, and snippets.

@aliakakis
Last active January 31, 2017 23:41
Show Gist options
  • Save aliakakis/2f36b3d4f8710bc33ecf2abf907b4c01 to your computer and use it in GitHub Desktop.
Save aliakakis/2f36b3d4f8710bc33ecf2abf907b4c01 to your computer and use it in GitHub Desktop.
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;
};
@aliakakis
Copy link
Author

aliakakis commented Jan 24, 2017

RouteTransition decorator for Grommet. Just wrap your class with this function or use @RouteTransition() to have a fade effect for your routes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment