Skip to content

Commit

Permalink
fix(Fade): fix TS props to work with TransitionType (#5398)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyletsang committed Aug 24, 2020
1 parent 055d25f commit 79447a7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/Fade.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@ import React, { useCallback } from 'react';
import Transition, {
ENTERED,
ENTERING,
TransitionProps,
} from 'react-transition-group/Transition';
import { TransitionCallbacks } from './helpers';
import triggerBrowserReflow from './triggerBrowserReflow';

export interface FadeProps extends Omit<TransitionProps, 'addEndListener'> {
export interface FadeProps extends TransitionCallbacks {
className?: string;
in?: boolean;
mountOnEnter?: boolean;
unmountOnExit?: boolean;
appear?: boolean;
timeout?: number;
children: React.ReactElement;
}

const propTypes = {
Expand Down Expand Up @@ -86,7 +88,7 @@ const fadeStyles = {
};

const Fade = React.forwardRef<Transition<any>, FadeProps>(
({ className, children, ...props }: FadeProps, ref) => {
({ className, children, ...props }, ref) => {
const handleEnter = useCallback(
(node) => {
triggerBrowserReflow(node);
Expand Down
5 changes: 4 additions & 1 deletion tests/simple-types-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ import {
Carousel,
Container,
Col,
Collapse,
Row,
Dropdown,
DropdownButton,
Fade,
Figure,
Form,
FormFile,
Expand Down Expand Up @@ -59,14 +61,15 @@ const noop = () => {};
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const MegaComponent = () => (
<>
<Alert transition={Fade} />
<Alert transition={Collapse} />
<Alert
ref={React.createRef<HTMLDivElement>()}
style={style}
closeLabel="close"
dismissible
onClose={noop}
show
// transition={} TODO
variant="primary"
bsPrefix="alert"
>
Expand Down

0 comments on commit 79447a7

Please sign in to comment.