File tree Expand file tree Collapse file tree 3 files changed +16
-15
lines changed Expand file tree Collapse file tree 3 files changed +16
-15
lines changed Original file line number Diff line number Diff line change @@ -75,20 +75,7 @@ export const Toast: FC<Props> = ({
7575} ) => {
7676 const insets = useSafeAreaInsets ( ) ;
7777 const { width, height } = useWindowDimensions ( ) ;
78-
79- useVisibilityChange (
80- ( ) => {
81- onToastShow ?.( toast ) ;
82- } ,
83- ( ) => {
84- onToastHide ?.( toast ) ;
85- } ,
86- toast . visible
87- ) ;
88-
8978 const isSystemDarkMode = useColorScheme ( ) === 'dark' ;
90- const isDarkMode =
91- overrideDarkMode !== undefined ? overrideDarkMode : isSystemDarkMode ;
9279
9380 const [ toastHeight , setToastHeight ] = useState < number > (
9481 toast ?. height ? toast . height : DEFAULT_TOAST_HEIGHT
@@ -98,6 +85,9 @@ export const Toast: FC<Props> = ({
9885 toast ?. width ? toast . width : width - 32 > maxWidth ? maxWidth : width - 32
9986 ) ;
10087
88+ const isDarkMode =
89+ overrideDarkMode !== undefined ? overrideDarkMode : isSystemDarkMode ;
90+
10191 const startingY = useMemo (
10292 ( ) =>
10393 toast . position === ToastPosition . TOP
@@ -111,6 +101,7 @@ export const Toast: FC<Props> = ({
111101 const offsetY = useSharedValue ( startingY ) ;
112102
113103 const onPress = ( ) => onToastPress ?.( toast ) ;
104+
114105 const dismiss = useCallback ( ( id : string ) => {
115106 toasting . dismiss ( id ) ;
116107 } , [ ] ) ;
@@ -215,6 +206,16 @@ export const Toast: FC<Props> = ({
215206 toast . animationConfig ,
216207 ] ) ;
217208
209+ useVisibilityChange (
210+ ( ) => {
211+ onToastShow ?.( toast ) ;
212+ } ,
213+ ( ) => {
214+ onToastHide ?.( toast ) ;
215+ } ,
216+ toast . visible
217+ ) ;
218+
218219 useEffect ( ( ) => {
219220 setToastHeight ( toast ?. height ? toast . height : DEFAULT_TOAST_HEIGHT ) ;
220221 } , [ toast . height ] ) ;
Original file line number Diff line number Diff line change @@ -60,8 +60,8 @@ export const Toasts: FunctionComponent<Props> = ({
6060 left : insets . left + ( extraInsets ?. left ?? 0 ) ,
6161 right : insets . right + ( extraInsets ?. right ?? 0 ) ,
6262 bottom : insets . bottom + ( extraInsets ?. bottom ?? 0 ) + 16 ,
63+ pointerEvents : 'box-none' ,
6364 } }
64- pointerEvents = { 'box-none' }
6565 >
6666 { toasts . map ( ( t ) => (
6767 < Toast
Original file line number Diff line number Diff line change 11export { useToaster } from './core/use-toaster' ;
22export { Toasts } from './components' ;
33export * from './headless' ;
4- export { ToastPosition , ToastAnimationType } from './core/types' ;
4+ export { ToastPosition , type ToastAnimationType } from './core/types' ;
You can’t perform that action at this time.
0 commit comments