Skip to content
This repository has been archived by the owner on Oct 20, 2022. It is now read-only.

Commit

Permalink
fix(Animate): Add extra div around the children in Animate
Browse files Browse the repository at this point in the history
This solves the problem when the children has top or bottom padding. Now we should only have single
child in each Animate.
  • Loading branch information
willeeklund authored and bstream committed May 31, 2017
1 parent 6429379 commit 88afb87
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/components/animate/animate.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Animate extends React.PureComponent {
transitionEnterTimeout={this.props.enterTime}
transitionLeaveTimeout={this.props.leaveTime}
>
{this.props.children}
{this.props.children ? <div>{this.props.children}</div> : null}
</CSSTransitionGroup>
);
}
Expand All @@ -54,6 +54,7 @@ class Animate extends React.PureComponent {
Animate.propTypes = {
children: PropTypes.node,
className: PropTypes.string,
/** This needs to be set in order for the component to render anything */
animationName: PropTypes.string.isRequired,
type: PropTypes.oneOf(['height']).isRequired,
enterTime: PropTypes.number.isRequired,
Expand Down
7 changes: 6 additions & 1 deletion src/components/animate/modifierHeight.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ export default ({
easingLeaveFunction = easings.easeOut,
}) => ({
overflow: 'hidden',
maxHeight: 'none',
boxSizing: 'border-box',

'& > div': {
overflow: 'hidden',
boxSizing: 'border-box',
},

[`&${classPrefixSpace ? ' ' : ''}.${name}`]: {
'&-enter': {
Expand Down

0 comments on commit 88afb87

Please sign in to comment.