diff --git a/src/common/Toast/Toast.js b/src/common/Toast/Toast.js index d29eb1775..a4e7aa01c 100644 --- a/src/common/Toast/Toast.js +++ b/src/common/Toast/Toast.js @@ -25,11 +25,9 @@ const Toast = React.forwardRef(({ className }, ref) => { } }, [] ); - const hideAll = React.useCallback(() => { dispatch({ type: 'removeAll' }); }, []); - const show = React.useCallback(({ type, icon, title, text, closeButton, timeout, onClick }) => { timeout = timeout !== null && !isNaN(timeout) ? timeout : DEFAULT_TIMEOUT; const close = () => { @@ -45,8 +43,8 @@ const Toast = React.forwardRef(({ className }, ref) => { dispatch({ type: 'add', item: newItem }); return close; }, []); - React.useImperativeHandle(ref, () => ({ show, hideAll })); + return toastItems.length === 0 ? null : (