This repository has been archived by the owner on Nov 7, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use react-transition-group instead of react-overlay transitions (…
…#61) react-overlay ^0.8 removed transition components, and instead uses react-transition-group package. This commit introduces changes analogous to react-bootstrap/react-bootstrap#2676
- Loading branch information
Showing
5 changed files
with
65 additions
and
22 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,38 @@ | ||
import React from 'react'; | ||
import Transition from 'react-overlays/lib/Transition'; | ||
import Transition, { | ||
ENTERED, | ||
ENTERING | ||
} from 'react-transition-group/Transition'; | ||
import cn from 'classnames'; | ||
|
||
class Fade extends React.Component { | ||
const fadeStyles = { | ||
[ENTERING]: 'in', | ||
[ENTERED]: 'in' | ||
}; | ||
|
||
constructor(props, context){ | ||
class Fade extends React.Component { | ||
constructor(props, context) { | ||
super(props, context); | ||
} | ||
|
||
render() { | ||
const { className, children, ...props } = this.props; | ||
return ( | ||
<Transition | ||
{...this.props} | ||
className='fade' | ||
enteredClassName='in' | ||
enteringClassName='in' | ||
/> | ||
<Transition {...props}> | ||
{(status, innerProps) => | ||
React.cloneElement(children, { | ||
...innerProps, | ||
className: cn( | ||
'fade', | ||
className, | ||
children.props.className, | ||
fadeStyles[status] | ||
) | ||
}) | ||
} | ||
</Transition> | ||
); | ||
} | ||
} | ||
|
||
export default Fade | ||
export default Fade; |
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
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