File tree 1 file changed +11
-4
lines changed 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -43,14 +43,18 @@ export interface CToastProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title
43
43
* @ignore
44
44
*/
45
45
key ?: number
46
- /**
47
- * Toggle the visibility of component.
48
- */
49
- visible ?: boolean
50
46
/**
51
47
* Callback fired when the component requests to be closed.
52
48
*/
53
49
onClose ?: ( index : number | null ) => void
50
+ /**
51
+ * Callback fired when the component requests to be shown.
52
+ */
53
+ onShow ?: ( index : number | null ) => void
54
+ /**
55
+ * Toggle the visibility of component.
56
+ */
57
+ visible ?: boolean
54
58
}
55
59
56
60
interface ContextProps extends CToastProps {
@@ -73,6 +77,7 @@ export const CToast = forwardRef<HTMLDivElement, CToastProps>(
73
77
key,
74
78
visible = false ,
75
79
onClose,
80
+ onShow,
76
81
...rest
77
82
} ,
78
83
ref ,
@@ -129,6 +134,7 @@ export const CToast = forwardRef<HTMLDivElement, CToastProps>(
129
134
< CSSTransition
130
135
in = { _visible }
131
136
timeout = { 250 }
137
+ onEnter = { ( ) => onShow && onShow ( index ? index : null ) }
132
138
onExited = { ( ) => onClose && onClose ( index ? index : null ) }
133
139
unmountOnExit
134
140
>
@@ -167,6 +173,7 @@ CToast.propTypes = {
167
173
index : PropTypes . number ,
168
174
key : PropTypes . number ,
169
175
onClose : PropTypes . func ,
176
+ onShow : PropTypes . func ,
170
177
visible : PropTypes . bool ,
171
178
}
172
179
You can’t perform that action at this time.
0 commit comments