@@ -66,12 +66,12 @@ export class Toast extends ViewController {
66
66
67
67
constructor ( opts : ToastOptions = { } ) {
68
68
opts . enableBackdropDismiss = isPresent ( opts . enableBackdropDismiss ) ? ! ! opts . enableBackdropDismiss : true ;
69
- console . log ( opts . enableBackdropDismiss ) ;
70
- super ( ToastCmp , opts ) ;
71
-
69
+ opts . dismissOnPageChange = isPresent ( opts . dismissOnPageChange ) ? ! ! opts . dismissOnPageChange : false ;
72
70
71
+ super ( ToastCmp , opts ) ;
73
72
this . viewType = 'toast' ;
74
- this . isOverlay = false ;
73
+ this . isOverlay = true ;
74
+ this . usePortal = true ;
75
75
76
76
// by default, toasts should not fire lifecycle events of other views
77
77
// for example, when an toast enters, the current active view should
@@ -108,6 +108,7 @@ export class Toast extends ViewController {
108
108
* | showCloseButton | `boolean` | false | Whether or not to show a button to close the toast. |
109
109
* | closeButtonText | `string` | "Close" | Text to display in the close button. |
110
110
* | enableBackdropDismiss | `boolean` | true | Whether the toast should be dismissed by tapping the backdrop. |
111
+ * | dismissOnPageChange | `boolean` | false | Whether to dismiss the toast when navigating to a new page. |
111
112
*
112
113
* @param {object } opts Toast options. See the above table for available options.
113
114
*/
@@ -226,6 +227,7 @@ export interface ToastOptions {
226
227
showCloseButton ?: boolean ;
227
228
closeButtonText ?: string ;
228
229
enableBackdropDismiss ?: boolean ;
230
+ dismissOnPageChange ?: boolean ;
229
231
}
230
232
231
233
class ToastSlideIn extends Transition {
@@ -235,7 +237,7 @@ class ToastSlideIn extends Transition {
235
237
let ele = enteringView . pageRef ( ) . nativeElement ;
236
238
let wrapper = new Animation ( ele . querySelector ( '.toast-wrapper' ) ) ;
237
239
238
- wrapper . fromTo ( 'translateY' , '100 %' , '0%' ) ;
240
+ wrapper . fromTo ( 'translateY' , '120 %' , '0%' ) ;
239
241
this . easing ( 'cubic-bezier(.36,.66,.04,1)' ) . duration ( 400 ) . add ( wrapper ) ;
240
242
}
241
243
}
@@ -247,7 +249,7 @@ class ToastSlideOut extends Transition {
247
249
let ele = leavingView . pageRef ( ) . nativeElement ;
248
250
let wrapper = new Animation ( ele . querySelector ( '.toast-wrapper' ) ) ;
249
251
250
- wrapper . fromTo ( 'translateY' , '0%' , '100 %' ) ;
252
+ wrapper . fromTo ( 'translateY' , '0%' , '120 %' ) ;
251
253
this . easing ( 'cubic-bezier(.36,.66,.04,1)' ) . duration ( 300 ) . add ( wrapper ) ;
252
254
}
253
255
}
@@ -261,7 +263,7 @@ class ToastMdSlideIn extends Transition {
261
263
let wrapper = new Animation ( ele . querySelector ( '.toast-wrapper' ) ) ;
262
264
263
265
backdrop . fromTo ( 'opacity' , 0 , 0 ) ;
264
- wrapper . fromTo ( 'translateY' , '100 %' , '0%' ) ;
266
+ wrapper . fromTo ( 'translateY' , '120 %' , '0%' ) ;
265
267
this . easing ( 'cubic-bezier(.36,.66,.04,1)' ) . duration ( 400 ) . add ( backdrop ) . add ( wrapper ) ;
266
268
}
267
269
}
@@ -274,7 +276,7 @@ class ToastMdSlideOut extends Transition {
274
276
let wrapper = new Animation ( ele . querySelector ( '.toast-wrapper' ) ) ;
275
277
let backdrop = new Animation ( ele . querySelector ( '.backdrop' ) ) ;
276
278
277
- wrapper . fromTo ( 'translateY' , '0%' , '100 %' ) ;
279
+ wrapper . fromTo ( 'translateY' , '0%' , '120 %' ) ;
278
280
backdrop . fromTo ( 'opacity' , 0 , 0 ) ;
279
281
this . easing ( 'cubic-bezier(.36,.66,.04,1)' ) . duration ( 450 ) . add ( backdrop ) . add ( wrapper ) ;
280
282
}
0 commit comments