1- import { OverlayToaster , Toaster } from "@blueprintjs/core" ;
1+ import { OverlayToaster } from "@blueprintjs/core" ;
22import h from "@macrostrat/hyper" ;
3- import {
4- createContext ,
5- useRef ,
6- useState ,
7- useContext ,
8- RefObject ,
9- useEffect ,
10- } from "react" ;
3+ import { createContext , useState , useContext , RefObject } from "react" ;
114import { createPortal } from "react-dom" ;
12- import type { OverlayToasterProps , ToasterInstance } from "@blueprintjs/core" ;
5+ import type { OverlayToasterProps } from "@blueprintjs/core" ;
136
147// We might want to refactor this
158function createAppToaster ( ) {
16- return Toaster . create ( ) ;
9+ return OverlayToaster . create ( ) ;
1710}
1811
1912type ContextualToasterProps = Omit <
@@ -27,7 +20,7 @@ export type ToasterContextProps = ContextualToasterProps & {
2720 containerRef ?: RefObject < HTMLElement > ;
2821} ;
2922
30- const ToasterCtx = createContext < ToasterInstance > ( null ) ;
23+ const ToasterCtx = createContext < any > ( null ) ;
3124
3225function ContextualToaster ( { containerRef, setToaster, ...rest } ) {
3326 const toaster = h ( OverlayToaster , {
@@ -43,15 +36,15 @@ function ContextualToaster({ containerRef, setToaster, ...rest }) {
4336
4437function ToasterContext ( props : ToasterContextProps ) {
4538 const { children, toasts, containerRef, ...rest } = props ;
46- const [ toaster , setToaster ] = useState < ToasterInstance > ( null ) ;
39+ const [ toaster , setToaster ] = useState < any > ( null ) ;
4740
4841 return h ( ToasterCtx . Provider , { value : toaster } , [
4942 h ( ContextualToaster , { containerRef, setToaster, ...rest } , toasts ) ,
5043 children ,
5144 ] ) ;
5245}
5346
54- function useToaster ( ) : ToasterInstance | null {
47+ function useToaster ( ) : any | null {
5548 return useContext ( ToasterCtx ) ;
5649}
5750
0 commit comments