@@ -3,7 +3,7 @@ import { useKeyboardBottomInset } from '@gluestack-ui/utils/hooks';
33import { Overlay } from '../../overlay/creator' ;
44import React from 'react' ;
55import { Platform , View } from 'react-native' ;
6- import { SafeAreaView } from 'react-native-safe-area-context' ;
6+ import { SafeAreaProvider , SafeAreaView } from 'react-native-safe-area-context' ;
77import { OverlayAnimatePresence } from './OverlayAnimatePresence' ;
88import { ToastContext } from './ToastContext' ;
99import type { IToast , ToastPlacement } from './types' ;
@@ -92,58 +92,57 @@ export const ToastList = () => {
9292 >
9393 { toastInfo [ position ] . map ( ( toast : IToast ) => {
9494 return (
95- < SafeAreaView
96- style = { { pointerEvents : 'box-none' } }
97- key = { toast . id }
98- >
99- < OverlayAnimatePresence
100- visible = { visibleToasts [ toast . id ] }
101- AnimatePresence = { AnimatePresence }
102- onExit = { ( ) => {
103- removeToast ( toast . id ) ;
104- toast . config ?. onCloseComplete &&
105- toast . config ?. onCloseComplete ( ) ;
106- } }
107- >
108- < AnimationView
109- initial = { {
110- opacity : 0 ,
111- y : transitionConfig [ position ] ,
95+ < SafeAreaProvider key = { toast . id } >
96+ < SafeAreaView style = { { pointerEvents : 'box-none' } } >
97+ < OverlayAnimatePresence
98+ visible = { visibleToasts [ toast . id ] }
99+ AnimatePresence = { AnimatePresence }
100+ onExit = { ( ) => {
101+ removeToast ( toast . id ) ;
102+ toast . config ?. onCloseComplete &&
103+ toast . config ?. onCloseComplete ( ) ;
112104 } }
113- animate = { {
114- opacity : 1 ,
115- y : 0 ,
116- } }
117- exit = { {
118- opacity : 0 ,
119- y : transitionConfig [ position ] ,
120- } }
121- transition = { {
122- type : 'timing' ,
123- duration : 150 ,
124- } }
125- key = { toast . id }
126- { ...toast . config ?. containerStyle }
127- style = { { pointerEvents : 'box-none' } }
128105 >
129- < View
130- style = { {
131- bottom :
132- [
133- 'bottom' ,
134- 'bottom-left' ,
135- 'bottom-right' ,
136- ] . includes ( position ) &&
137- toast . config ?. avoidKeyboard
138- ? bottomInset
139- : undefined ,
106+ < AnimationView
107+ initial = { {
108+ opacity : 0 ,
109+ y : transitionConfig [ position ] ,
110+ } }
111+ animate = { {
112+ opacity : 1 ,
113+ y : 0 ,
114+ } }
115+ exit = { {
116+ opacity : 0 ,
117+ y : transitionConfig [ position ] ,
118+ } }
119+ transition = { {
120+ type : 'timing' ,
121+ duration : 150 ,
140122 } }
123+ key = { toast . id }
124+ { ...toast . config ?. containerStyle }
125+ style = { { pointerEvents : 'box-none' } }
141126 >
142- { toast . component }
143- </ View >
144- </ AnimationView >
145- </ OverlayAnimatePresence >
146- </ SafeAreaView >
127+ < View
128+ style = { {
129+ bottom :
130+ [
131+ 'bottom' ,
132+ 'bottom-left' ,
133+ 'bottom-right' ,
134+ ] . includes ( position ) &&
135+ toast . config ?. avoidKeyboard
136+ ? bottomInset
137+ : undefined ,
138+ } }
139+ >
140+ { toast . component }
141+ </ View >
142+ </ AnimationView >
143+ </ OverlayAnimatePresence >
144+ </ SafeAreaView >
145+ </ SafeAreaProvider >
147146 ) ;
148147 } ) }
149148 </ View >
0 commit comments