@@ -8,14 +8,22 @@ export interface CTabPaneProps extends HTMLAttributes<HTMLDivElement> {
8
8
* A string of all className you want applied to the base component.
9
9
*/
10
10
className ?: string
11
+ /**
12
+ * Callback fired when the component requests to be hidden.
13
+ */
14
+ onHide ?: ( ) => void
15
+ /**
16
+ * Callback fired when the component requests to be shown.
17
+ */
18
+ onShow ?: ( ) => void
11
19
/**
12
20
* Toggle the visibility of component.
13
21
*/
14
22
visible ?: boolean
15
23
}
16
24
17
25
export const CTabPane = forwardRef < HTMLDivElement , CTabPaneProps > (
18
- ( { children, className, visible, ...rest } , ref ) => {
26
+ ( { children, className, onHide , onShow , visible, ...rest } , ref ) => {
19
27
const style = {
20
28
transition : `opacity 150ms linear` ,
21
29
}
@@ -32,7 +40,7 @@ export const CTabPane = forwardRef<HTMLDivElement, CTabPaneProps>(
32
40
33
41
const _className = classNames ( 'tab-pane' , 'fade' , className )
34
42
return (
35
- < Transition in = { visible } timeout = { 350 } >
43
+ < Transition in = { visible } onEnter = { onShow } onExit = { onHide } timeout = { 350 } >
36
44
{ ( state ) => {
37
45
const transitionClass = getTransitionClass ( state )
38
46
return (
@@ -54,6 +62,8 @@ export const CTabPane = forwardRef<HTMLDivElement, CTabPaneProps>(
54
62
CTabPane . propTypes = {
55
63
children : PropTypes . node ,
56
64
className : PropTypes . string ,
65
+ onHide : PropTypes . func ,
66
+ onShow : PropTypes . func ,
57
67
visible : PropTypes . bool ,
58
68
}
59
69
0 commit comments