Open CheryloO opened 4 years ago
try this way:
replace
interface TransitionProps extends CSSTransitionProps { animation?: AnimationName, wrapper?: boolean }
with
type TransitionProps = CSSTransitionProps & { animation?: AnimationName, wrapper?: boolean }
import { CSSTransition } from 'react-transition-group'; import { CSSTransitionProps } from 'react-transition-group/CSSTransition';
type AnimationName = 'zoom-in-top' | 'zoom-in-left' | 'zoom-in-bottom' | 'zoom-in-right'
interface TransitionProps extends CSSTransitionProps { animation?: AnimationName, wrapper?: boolean }
const Transition: React.FC = (props) => {
const {
children,
classNames,
animation,
...restProps
} = props
return (
<CSSTransition
classNames = { classNames ? classNames : animation }
{...restProps}
Transition.defaultProps = { unmountOnExit: true, appear: true }
export default Transition