File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 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
4343 * @ignore
4444 */
4545 key ?: number
46- /**
47- * Toggle the visibility of component.
48- */
49- visible ?: boolean
5046 /**
5147 * Callback fired when the component requests to be closed.
5248 */
5349 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
5458}
5559
5660interface ContextProps extends CToastProps {
@@ -73,6 +77,7 @@ export const CToast = forwardRef<HTMLDivElement, CToastProps>(
7377 key,
7478 visible = false ,
7579 onClose,
80+ onShow,
7681 ...rest
7782 } ,
7883 ref ,
@@ -129,6 +134,7 @@ export const CToast = forwardRef<HTMLDivElement, CToastProps>(
129134 < CSSTransition
130135 in = { _visible }
131136 timeout = { 250 }
137+ onEnter = { ( ) => onShow && onShow ( index ? index : null ) }
132138 onExited = { ( ) => onClose && onClose ( index ? index : null ) }
133139 unmountOnExit
134140 >
@@ -167,6 +173,7 @@ CToast.propTypes = {
167173 index : PropTypes . number ,
168174 key : PropTypes . number ,
169175 onClose : PropTypes . func ,
176+ onShow : PropTypes . func ,
170177 visible : PropTypes . bool ,
171178}
172179
You can’t perform that action at this time.
0 commit comments