@@ -118,13 +118,15 @@ export default class Toast extends BaseComponent {
118
118
setupRelativeAnimation ( getHeight ( nextProps ) ) ;
119
119
}
120
120
121
- const newState = animated ? {
122
- animationConfig : this . getAnimation ( visible ) ,
123
- contentAnimation : this . getContentAnimation ( visible ) ,
124
- } : {
125
- animationConfig : { } ,
126
- contentAnimation : { } ,
127
- } ;
121
+ const newState = animated
122
+ ? {
123
+ animationConfig : this . getAnimation ( visible ) ,
124
+ contentAnimation : this . getContentAnimation ( visible ) ,
125
+ }
126
+ : {
127
+ animationConfig : { } ,
128
+ contentAnimation : { } ,
129
+ } ;
128
130
129
131
this . setState ( newState ) ;
130
132
}
@@ -137,7 +139,7 @@ export default class Toast extends BaseComponent {
137
139
getPositionStyle ( ) {
138
140
const { position} = this . props ;
139
141
140
- return ( position === 'relative' ) ? { position} : getAbsolutePositionStyle ( position ) ;
142
+ return position === 'relative' ? { position} : getAbsolutePositionStyle ( position ) ;
141
143
}
142
144
143
145
getAnimation ( shouldShow ) {
@@ -225,6 +227,7 @@ export default class Toast extends BaseComponent {
225
227
}
226
228
}
227
229
230
+ // This weird layout should support iphoneX safe are
228
231
render ( ) {
229
232
const { backgroundColor, actions, allowDismiss, enableBlur, zIndex} = this . getThemeProps ( ) ;
230
233
const { animationConfig} = this . state ;
@@ -240,29 +243,33 @@ export default class Toast extends BaseComponent {
240
243
}
241
244
242
245
return (
243
- < Animatable . View
244
- style = { [
245
- this . styles . container ,
246
- hasOneAction && this . styles . containerWithOneAction ,
247
- positionStyle ,
248
- backgroundColor && { backgroundColor} ,
249
- { height} ,
250
- { zIndex} ,
251
- ] }
252
- { ...animationConfig }
253
- >
254
- { enableBlur && < BlurView style = { this . styles . blurView } { ...blurOptions } /> }
255
- < View row flex centerV spread >
256
- { this . renderMessage ( ) }
257
- { ( hasOneAction || allowDismiss ) && (
258
- < View row height = "100%" >
259
- { hasOneAction && this . renderOneAction ( ) }
260
- { this . renderDismissButton ( ) }
261
- </ View >
262
- ) }
263
- </ View >
264
- { hasTwoActions && < View > { this . renderTwoActions ( ) } </ View > }
265
- </ Animatable . View >
246
+ < View style = { [ positionStyle ] } useSafeArea >
247
+ < View height = { height } />
248
+
249
+ < Animatable . View
250
+ style = { [
251
+ this . styles . container ,
252
+ backgroundColor && { backgroundColor} ,
253
+ hasOneAction && this . styles . containerWithOneAction ,
254
+ { zIndex} ,
255
+ ] }
256
+ { ...animationConfig }
257
+ >
258
+ { enableBlur && < BlurView style = { this . styles . blurView } { ...blurOptions } /> }
259
+
260
+ < View row height = { height } centerV spread >
261
+ { this . renderMessage ( ) }
262
+ { ( hasOneAction || allowDismiss ) && (
263
+ < View row height = "100%" >
264
+ { hasOneAction && this . renderOneAction ( ) }
265
+ { this . renderDismissButton ( ) }
266
+ </ View >
267
+ ) }
268
+ </ View >
269
+
270
+ { hasTwoActions && < View > { this . renderTwoActions ( ) } </ View > }
271
+ </ Animatable . View >
272
+ </ View >
266
273
) ;
267
274
}
268
275
@@ -283,6 +290,7 @@ export default class Toast extends BaseComponent {
283
290
function createStyles ( ) {
284
291
return StyleSheet . create ( {
285
292
container : {
293
+ ...StyleSheet . absoluteFillObject ,
286
294
backgroundColor : Colors . rgba ( ThemeManager . primaryColor , 0.8 ) ,
287
295
paddingHorizontal : 15 ,
288
296
} ,
@@ -360,7 +368,7 @@ function setupRelativeAnimation(height) {
360
368
361
369
function getHeight ( { height, actions} ) {
362
370
if ( _ . isUndefined ( height ) ) {
363
- return ( _ . size ( actions ) === 2 ) ? 92 : 48 ;
371
+ return _ . size ( actions ) === 2 ? 92 : 48 ;
364
372
}
365
373
return height ;
366
374
}
0 commit comments