@@ -97,6 +97,7 @@ class Toast extends Component {
9797 this . startTimer = this . startTimer . bind ( this ) ;
9898 this . animate = this . animate . bind ( this ) ;
9999 this . show = this . show . bind ( this ) ;
100+ this . displayToast = this . displayToast . bind ( this ) ;
100101 this . hide = this . hide . bind ( this ) ;
101102 this . onLayout = this . onLayout . bind ( this ) ;
102103
@@ -132,9 +133,10 @@ class Toast extends Component {
132133 const { inProgress : prevInProgress , isVisible : prevIsVisible } = prevState ;
133134
134135 if ( ! inProgress && ! isVisible && prevInProgress && prevIsVisible && toastQueue . length > 0 ) {
136+ const toastQueueUpdated = [ ...toastQueue ] . slice ( 0 , - 1 ) ;
137+
135138 toastQueue [ toastQueue . length - 1 ] ( ) ;
136- const toastQueueCopy = [ ...toastQueue ] . slice ( 0 , - 1 ) ;
137- this . setState ( { toastQueue : toastQueueCopy } )
139+ this . setState ( { toastQueue : toastQueueUpdated } )
138140 }
139141 }
140142
@@ -226,7 +228,7 @@ class Toast extends Component {
226228 const { inProgress, isVisible } = this . state ;
227229
228230 if ( inProgress || isVisible ) {
229- this . setState ( { toastQueue : [ ...this . state . toastQueue , ( ) => this . displayToast ( options ) ] } )
231+ this . setState ( { toastQueue : [ ...this . state . toastQueue , ( ) => this . displayToast ( options ) ] } )
230232 } else {
231233 this . displayToast ( options )
232234 }
@@ -327,7 +329,7 @@ class Toast extends Component {
327329 ...config
328330 } ;
329331
330- const { type, customProps, inProgress , isVisible } = this . state ;
332+ const { type, customProps} = this . state ;
331333 const toastComponent = componentsConfig [ type ] ;
332334
333335 if ( ! toastComponent ) {
@@ -338,7 +340,6 @@ class Toast extends Component {
338340 return null ;
339341 }
340342
341-
342343 return toastComponent ( {
343344 ...includeKeys ( {
344345 obj : this . state ,
0 commit comments