Skip to content

Commit

Permalink
Merge af54caa into a1385aa
Browse files Browse the repository at this point in the history
  • Loading branch information
zaleGZL committed Feb 17, 2020
2 parents a1385aa + af54caa commit 17da2ac
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/todo.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class TodoList extends React.Component {
return (
<div>
<button onClick={this.handleAdd}>Add Item</button>
<Animate transitionName="fade">
<Animate transitionName="fade" component={React.Fragment}>
{items}
</Animate>
</div>
Expand Down
6 changes: 5 additions & 1 deletion src/Animate.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ function getChildrenFromProps(props) {
function noop() {
}

function isReactFragment(component) {
return React.Fragment && component === React.Fragment;
}

class Animate extends React.Component {
static isAnimate = true; // eslint-disable-line

Expand Down Expand Up @@ -321,7 +325,7 @@ class Animate extends React.Component {
}
const Component = props.component;
if (Component) {
let passedProps = props;
let passedProps = isReactFragment(Component) ? {} : props;
if (typeof Component === 'string') {
passedProps = {
className: props.className,
Expand Down
2 changes: 1 addition & 1 deletion tests/multiple.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class TodoList extends React.Component {
});
return (
<div>
<Animate transitionName="example">
<Animate transitionName="example" component={React.Fragment}>
{items}
</Animate>
</div>
Expand Down

0 comments on commit 17da2ac

Please sign in to comment.