Skip to content

Commit 79447a7

Browse files
authored
fix(Fade): fix TS props to work with TransitionType (react-bootstrap#5398)
1 parent 055d25f commit 79447a7

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/Fade.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,18 @@ import React, { useCallback } from 'react';
55
import Transition, {
66
ENTERED,
77
ENTERING,
8-
TransitionProps,
98
} from 'react-transition-group/Transition';
9+
import { TransitionCallbacks } from './helpers';
1010
import triggerBrowserReflow from './triggerBrowserReflow';
1111

12-
export interface FadeProps extends Omit<TransitionProps, 'addEndListener'> {
12+
export interface FadeProps extends TransitionCallbacks {
13+
className?: string;
1314
in?: boolean;
1415
mountOnEnter?: boolean;
1516
unmountOnExit?: boolean;
1617
appear?: boolean;
1718
timeout?: number;
19+
children: React.ReactElement;
1820
}
1921

2022
const propTypes = {
@@ -86,7 +88,7 @@ const fadeStyles = {
8688
};
8789

8890
const Fade = React.forwardRef<Transition<any>, FadeProps>(
89-
({ className, children, ...props }: FadeProps, ref) => {
91+
({ className, children, ...props }, ref) => {
9092
const handleEnter = useCallback(
9193
(node) => {
9294
triggerBrowserReflow(node);

tests/simple-types-test.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ import {
1818
Carousel,
1919
Container,
2020
Col,
21+
Collapse,
2122
Row,
2223
Dropdown,
2324
DropdownButton,
25+
Fade,
2426
Figure,
2527
Form,
2628
FormFile,
@@ -59,14 +61,15 @@ const noop = () => {};
5961
// eslint-disable-next-line @typescript-eslint/no-unused-vars
6062
const MegaComponent = () => (
6163
<>
64+
<Alert transition={Fade} />
65+
<Alert transition={Collapse} />
6266
<Alert
6367
ref={React.createRef<HTMLDivElement>()}
6468
style={style}
6569
closeLabel="close"
6670
dismissible
6771
onClose={noop}
6872
show
69-
// transition={} TODO
7073
variant="primary"
7174
bsPrefix="alert"
7275
>

0 commit comments

Comments
 (0)