File tree Expand file tree Collapse file tree 1 file changed +5
-10
lines changed
packages/ui-components/src/Providers/NotificationProvider Expand file tree Collapse file tree 1 file changed +5
-10
lines changed Original file line number Diff line number Diff line change @@ -27,25 +27,20 @@ export const useNotification = () => useContext(NotificationDispatch);
2727
2828export const NotificationProvider : FC < PropsWithChildren > = ( { children } ) => {
2929 const [ notification , dispatch ] = useState < NotificationContextType > ( null ) ;
30- const [ isOpen , setIsOpen ] = useState ( false ) ;
3130
3231 useEffect ( ( ) => {
33- if ( notification ) {
34- setIsOpen ( true ) ;
35- const timeout = setTimeout ( ( ) => {
36- setIsOpen ( false ) ;
37- } , notification . duration ) ;
38- return ( ) => clearTimeout ( timeout ) ;
39- }
32+ const timeout = setTimeout ( ( ) => dispatch ( null ) , notification ?. duration ) ;
33+
34+ return ( ) => clearTimeout ( timeout ) ;
4035 } , [ notification ] ) ;
4136
4237 return (
4338 < NotificationContext . Provider value = { notification } >
4439 < NotificationDispatch . Provider value = { dispatch } >
45- < Toast . Provider swipeDirection = "right" >
40+ < Toast . Provider >
4641 { children }
4742 { notification && (
48- < Notification open = { isOpen } duration = { notification . duration } >
43+ < Notification duration = { notification . duration } >
4944 { notification . message }
5045 </ Notification >
5146 ) }
You can’t perform that action at this time.
0 commit comments